package cn.cecep.talroad.data.analyse.task.anomaly.analysis;

import cn.cecep.talroad.data.analyse.task.constant.impl.*;
import cn.cecep.talroad.data.analyse.task.enums.DataAnomalyFactoryServiceEnum;
import cn.cecep.talroad.data.analyse.task.logic.impl.*;
import cn.cecep.talroad.data.analyse.task.missing.impl.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * @author hehongyu
 * @description: 获取具体实现类的抽象工厂
 * @date 2023/6/10 5:14
 */
@Component
@RequiredArgsConstructor
public class DataAnomalyAbstractFactory {

    public static Map<DataAnomalyFactoryServiceEnum,DataAnomalyAbstractService> serviceMap = new HashMap<>();

    private final SteelDataLogicService steelDataLogicService;
    private final BurnDataLogicService burnDataLogicService;
    private final CementDataLogicService cementDataLogicService;
    private final CokingDataLogicService cokingDataLogicService;
    private final GlassDataLogicService glassDataLogicService;
    private final PowerDataLogicService powerDataLogicService;
    private final WaterDataLogicService waterDataLogicService;
    private final GasDataLogicService gasDataLogicService;

    private final SteelDataMissingService steelDataMissingService;
    private final BurnDataMissingService burnDataMissingService;
    private final CementDataMissingService cementDataMissingService;
    private final CokingDataMissingService cokingDataMissingService;
    private final GlassDataMissingService glassDataMissingService;
    private final PowerDataMissingService powerDataMissingService;
    private final WaterDataMissingService waterDataMissingService;
    private final GasDataMissingService gasDataMissingService;
    private final ElecDataMissingService elecDataMissingService;
    private final GasMonDataMissingService gasMonDataMissingService;
    private final OdsDataMissingService odsDataRealService;
    private final OdsMeShingShStationService odsMeShingShStationService;
    private final OdsMeShingWeiStationService odsMeShingWeiStationService;


    private final SteelDataConstantService steelDataConstantService;
    private final BurnDataConstantService burnDataConstantService;
    private final CementDataConstantService cementDataConstantService;
    private final CokingDataConstantService cokingDataConstantService;
    private final GlassDataConstantService glassDataConstantService;
    private final PowerDataConstantService powerDataConstantService;
    private final WaterDataConstantService waterDataConstantService;
    private final GasDataConstantService gasDataConstantService;
    private final ElecDataConstantService elecDataConstantService;

    @PostConstruct
    public void init(){
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_GT,steelDataLogicService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_FS,burnDataLogicService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_SN,cementDataLogicService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_JH,cokingDataLogicService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_BL,glassDataLogicService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_DL,powerDataLogicService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_WATER,waterDataLogicService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.LOGIC_GAS,gasDataLogicService);

        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_GT,steelDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_FS,burnDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_SN,cementDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_JH,cokingDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_BL,glassDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_DL,powerDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_WATER,waterDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_GAS, gasDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.MISSING_ELEC, elecDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_WZZJC, gasMonDataMissingService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_WZZWZJC, odsDataRealService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_WGHSH, odsMeShingShStationService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_WGHWEI, odsMeShingWeiStationService);


        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_GT,steelDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_FS,burnDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_SN,cementDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_JH,cokingDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_BL,glassDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_DL,powerDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_WATER,waterDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_GAS,gasDataConstantService);
        serviceMap.put(DataAnomalyFactoryServiceEnum.CONSTANT_ELEC,elecDataConstantService);
    }


    public static DataAnomalyAbstractService getService(DataAnomalyFactoryServiceEnum key){
        return serviceMap.get(key);
    }

}
