package cn.cecep.talroad.util;

import lombok.Data;
import org.springframework.stereotype.Component;

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

/**
 * 废气排放量因子映射容器工具
 */
@Component

public class EmissionsConstants {

    /**
     * 废气排口浓度因子字典
     */
    private Map<String,String> gasPollutants;

    /**
     * 废水排口浓度因子字典
     */
    private Map<String,String> waterPollutants;

    /**
     * 废水排放许可要求map
     */
    private Map<String,String> waterAllowableEmissionMap;

    /**
     * 废水实际排放map
     * @return
     */
    private Map<String,String> waterActuallyEmittingMap;

    /**
     * 废气排放许可要求map
     */
    private Map<String,String> gasAllowableEmissionMap;

    /**
     * 废气实际排放map
     * @return
     */
    private Map<String,String> gasActuallyEmittingMap;

    /**
     * 废气重点四个字段
     * @return
     */
    private Map<String, String> gasImportantFieldMap;

    /**
     * 废水重点四个字段
     * @return
     */
    private Map<String, String> waterImportantFieldMap;

    public Map<String, String> getGasPollutants() {
        return gasPollutants;
    }

    public Map<String, String> getWaterPollutants() {
        return waterPollutants;
    }

    public Map<String, String> getWaterActuallyEmittingMap() {
        return waterActuallyEmittingMap;
    }

    public Map<String, String> getWaterAllowableEmissionMap() {
        return waterAllowableEmissionMap;
    }

    public Map<String, String> getGasActuallyEmittingMap() {
        return gasActuallyEmittingMap;
    }

    public Map<String, String> getGasAllowableEmissionMap() {
        return gasAllowableEmissionMap;
    }

    public Map<String, String> getGasImportantFieldMap() {
        return gasImportantFieldMap;
    }

    public Map<String, String> getWaterImportantFieldMap() {
        return waterImportantFieldMap;
    }

    @PostConstruct
    public void init(){
        initGas();
        initWater();
        initWaterAllowableEmissionMap();
        initWaterActuallyEmittingMap();
        initGasAllowableEmissionMap();
        initGasActuallyEmittingMap();
        initGasImportantFieldMap();
        initWaterImportantFieldMap();
    }

    /**
     * 初始化废气因子
     */
    private void initGas() {
        gasPollutants = new HashMap<>();
        gasPollutants.put("A21004","No2");
        gasPollutants.put("A21003","No");
        gasPollutants.put("A21002","Nox");
        gasPollutants.put("A21026","So2");
        gasPollutants.put("A99907","Vocs");
        gasPollutants.put("A99911","Pm");
        gasPollutants.put("A34013","SmokeDust");
    }

    private void initWater(){
        waterPollutants = new HashMap<>();
        waterPollutants.put("W21003","AmmoniaNitrogen");
        waterPollutants.put("W21001","NitrogenConcentration");
        waterPollutants.put("W01018","Cod");
        waterPollutants.put("W21011","PhosphorusConcentration");
    }

    private void initWaterAllowableEmissionMap(){
        waterAllowableEmissionMap = new HashMap<>();
        waterAllowableEmissionMap.put("W01018","Cod");
        waterAllowableEmissionMap.put("W21001","Tn");
        waterAllowableEmissionMap.put("W21003","Nhn");
        waterAllowableEmissionMap.put("W21011","Tp");

    }

    private void initWaterActuallyEmittingMap(){
        waterActuallyEmittingMap = new HashMap<>();
        waterActuallyEmittingMap.put("W01018","Cod");
        waterActuallyEmittingMap.put("W21001","Tn");
        waterActuallyEmittingMap.put("W21003","Nhn");
        waterActuallyEmittingMap.put("W21011","Tp");

    }

    private void initGasAllowableEmissionMap(){
        gasAllowableEmissionMap = new HashMap<>();
        gasAllowableEmissionMap.put("A21002","Nox");
        gasAllowableEmissionMap.put("A99907","Vocs");
        gasAllowableEmissionMap.put("A21026","So2");
        gasAllowableEmissionMap.put("A99911","Pm");

    }

    private void initGasActuallyEmittingMap(){
        gasActuallyEmittingMap = new HashMap<>();
        gasActuallyEmittingMap.put("A21002","Nox");
        gasActuallyEmittingMap.put("A99907","Vocs");
        gasActuallyEmittingMap.put("A21026","So2");
        gasActuallyEmittingMap.put("A99911","Pm");
    }

    /**
     *
     */
    private void initGasImportantFieldMap() {
        gasImportantFieldMap = new HashMap<>();
        gasImportantFieldMap.put("A21002", "Nox");
        gasImportantFieldMap.put("A21026", "So2");
        gasImportantFieldMap.put("A99901", "Vocs");
        gasImportantFieldMap.put("A99911", "Pm");
    }

    private void initWaterImportantFieldMap() {
        waterImportantFieldMap = new HashMap<>();
        waterImportantFieldMap.put("W21003","AmmoniaNitrogen");
        waterImportantFieldMap.put("W21001","NitrogenConcentration");
        waterImportantFieldMap.put("W01018","CodConcentration");
        waterImportantFieldMap.put("W21011","PhosphorusConcentration");
    }

}
