package cn.cecep.talroad.data.analyse.task.limestone;

import cn.cecep.talroad.data.analyse.task.enums.LimestoneDataAnomalyFactoryServiceEnum;
import cn.cecep.talroad.data.analyse.task.limestone.dry.SteelRealDryAnomalyLimestoneService;
import cn.cecep.talroad.data.analyse.task.limestone.wet.DlRealWetAnomalyLimestoneService;
import cn.cecep.talroad.data.analyse.task.limestone.wet.SteelRealWetAnomalyLimestoneService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

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

@Component
@RequiredArgsConstructor
public class LimestoneAnomalyAbstractFactory {

    private static Map<LimestoneDataAnomalyFactoryServiceEnum, BaseAnomalyLimestoneService> serviceMap = new HashMap<>();

    // 干
    private final SteelRealDryAnomalyLimestoneService steelRealDryAnomalyLimestoneService;

    // 湿
    private final DlRealWetAnomalyLimestoneService dlRealWetAnomalyLimestoneService;
    private final SteelRealWetAnomalyLimestoneService steelRealWetAnomalyLimestoneService;

    @PostConstruct
    public void init(){
        serviceMap.put(LimestoneDataAnomalyFactoryServiceEnum.DRY_STEEL,steelRealDryAnomalyLimestoneService);

        serviceMap.put(LimestoneDataAnomalyFactoryServiceEnum.WET_DL,dlRealWetAnomalyLimestoneService);
        serviceMap.put(LimestoneDataAnomalyFactoryServiceEnum.WET_STEEL,steelRealWetAnomalyLimestoneService);
    }

    public List<BaseAnomalyLimestoneService> getWetAnomalyAbstract(){
        List<BaseAnomalyLimestoneService> baseAnomalyLimestoneServices = new ArrayList<BaseAnomalyLimestoneService>(){
            {
                add(serviceMap.get(LimestoneDataAnomalyFactoryServiceEnum.WET_DL));
                add(serviceMap.get(LimestoneDataAnomalyFactoryServiceEnum.WET_STEEL));
            }
        };
        return baseAnomalyLimestoneServices;
    }

    public List<BaseAnomalyLimestoneService> getDryAnomalyAbstract(){
        List<BaseAnomalyLimestoneService> baseAnomalyLimestoneServices = new ArrayList<BaseAnomalyLimestoneService>(){
            {
                add(serviceMap.get(LimestoneDataAnomalyFactoryServiceEnum.DRY_STEEL));
            }
        };
        return baseAnomalyLimestoneServices;
    }

}
