package cn.cecep.talroad.enums;

import java.util.Arrays;

public enum ProblemTypeEnum {
    STABLE_LOW("001002","时均值稳定低值"),
    SJQS("006001","数据缺失"),
    SJHD("006002","数据恒值"),
    SJLJYC("006003","数据逻辑异常"),
    DATA_LOGIC("006003","数据逻辑异常"),
    STOP_RUN("002002","启停问题"),
    RELEASE("002001","CO放散问题"),
    GAS_UNRECOVER("002003","煤气未回收问题"),
    SSTY("004001001","治理设施停运"),
    OVER_STAND("003002","浓度超标"),
    PRESS_OVER_STAND("004002001","布袋除尘器压差频繁超高限"),
    PRESS_LOW_STAND("004002002","布袋除尘器压差过低"),
    JDCC_GG("004002003","静电除尘二次电流高，二次电压低"),
    JDCC_YC("004002004","静电除尘电流、电压异常波动"),
    JDCC_GD("004002005","静电除尘器二次电流过小"),
    PH_OVER("004002006","PH超出合理范围"),
    PUMP_ERROR("004002008","湿法脱硫循环泵运行异常"),
    OX_ERROR("004002009","湿法脱硫氧化风机运行异常"),
    SCR_TEMP_ERROR("004002012","SCR脱硝反应区温度过低"),
    WARN("003003","浓度预警"),
    PERMIT_WARN("007001","许可证延续"),
    PERMIT_EXCEED("007002","许可证整改超期"),
    WET("004002010","湿法脱硫脱硫剂仓料（液)位与药剂投加量逻辑异常"),
    DRY("004002011","半干法脱硫脱硫剂仓料（液)位与药剂投加量逻辑异常"),
    //TODO 待确认该枚举是否正确
    POLLUTION_CONTROL_EXCEEDED("0040020112","污染源管控超标"),
    FREQUENCY_MEASUREMENT("006005","手工监测频次不满足许可证要求"),
    CONCENTRATION_EXCEEDED_TYPE("003002","浓度超标类型"),

    ;

    private String code;
    private String name;

    ProblemTypeEnum(String code,String name){
        this.code = code;
        this.name = name;
    }

    /**
     * 根据编码获取名称
     * @param code
     * @return
     */
    public String getNameByCode(String code){
        return Arrays.stream(values()).filter(v -> v.getCode().equalsIgnoreCase(code)).findAny().get().getName();
    }

    /**
     * 根据编码获取枚举类型
     * @param code
     * @return
     */
    public ProblemTypeEnum getEnumByCode(String code){
        return Arrays.stream(values()).filter(v -> v.getCode().equalsIgnoreCase(code)).findAny().get();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
