package com.jay.monitor.data.server.config.props;

import com.jay.monitor.data.server.enums.DataSplitType;
import com.jay.monitor.data.server.enums.StoreType;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;

/**
 * @Module 配置
 * @Description 监控服务器配置属性
 * @Author liukaixiong
 * @Date 2020/11/5 13:52
 */
@ConfigurationProperties(prefix = "spring.monitor-server")
public class MonitorProperties {


    private StoreType storeType;
    /**
     * 存储配置规则
     * key -> {@link com.jay.monitor.data.server.enums.StoreType}
     */
    private Map<StoreType, StoreInfo> storeInfo = new HashMap<>();

    public Map<StoreType, StoreInfo> getStoreInfo() {
        return storeInfo;
    }

    public void setStoreInfo(Map<StoreType, StoreInfo> storeInfo) {
        this.storeInfo = storeInfo;
    }

    public StoreType getStoreType() {
        return storeType;
    }

    public void setStoreType(StoreType storeType) {
        this.storeType = storeType;
    }

    public static class StoreInfo {

        /**
         * 表的拆分配置规则
         * Key -> 表名
         */
        private Map<String, DataSplitType> tableRule = new HashMap<>();

        public Map<String, DataSplitType> getTableRule() {
            return tableRule;
        }

        public void setTableRule(Map<String, DataSplitType> tableRule) {
            this.tableRule = tableRule;
        }
    }


}
