package com.limap.common.enums.iot;

/**
 * @author Lenovo
 */
public enum ControllerErrorCode {

    /**
     * 异常码对应的信息
     */
    A_phase_miss("1001","1201","输入缺A相",null,null,null, null),
    B_phase_miss("1002","1202","输入缺B相",null,null ,null, null),
    C_phase_miss("1003","1203","输入缺C相",null,null ,null, null),
    queXiang_port1_A("1010","1210","输出缺A相","relayOneName",null ,null, null),
    queXiang_port1_B("1011","1211","输出缺B相","relayOneName",null ,null, null),
    queXiang_port1_C("1012","1212","输出缺C相","relayOneName",null ,null, null),
    kongzai_port1_all("1046","1246","输出空载","relayOneName",true ,"Switch1", "电流"),
    queXiang_port2_A("1013","1213","输出缺A相","relayTwoName",null ,null, null),
    queXiang_port2_B("1014","1214","输出缺B相","relayTwoName",null ,null, null),
    queXiang_port2_C("1015","1215","输出缺C相","relayTwoName",null ,null, null),
    kongzai_port2_all("1047","1247","输出空载","relayTwoName",true ,"Switch2", "电流"),
    kongzai_port3_all("1048","1248","输出空载","relayThreeName",true ,"Switch3", "电流"),
    kongzai_port4_all("1049","1249","输出空载","relayFourName",true ,"Switch4", "电流"),
    queXiang_port3_A("1016","1216","输出缺A相","relayThreeName",null ,"Switch3", null),
    queXiang_port3_B("1017","1217","输出缺B相","relayThreeName",null ,"Switch3", null),
    queXiang_port3_C("1018","1218","输出缺C相","relayThreeName",null ,"Switch3", null),
    queXiang_port4_A("1019","1219","输出缺A相","relayFourName",null ,"Switch4", null),
    queXiang_port4_B("1020","1220","输出缺B相","relayFourName",null ,"Switch4", null),
    queXiang_port4_C("1021","1221","输出缺C相","relayFourName",null ,"Switch4", null),

    A_over_voltage("1004","1204","A相过压",null,false ,null, "电压"),
    A_under_voltage("1005","1205","A相欠压",null,false  ,null, "电压"),
    B_over_voltage("1006","1206","B相过压",null,false  ,null, "电压"),
    B_under_voltage("1007","1207","B相欠压",null,false  ,null, "电压"),
    C_over_voltage("1008","1208","C相过压",null,false  ,null, "电压"),
    C_under_voltage("1009","1209","C相欠压",null,false  ,null, "电压"),
    guoYa_port1("2001","2201","输入过压","relayOneName",false  ,"Switch1", "电压"),
    guoYa_port2("2002","2202","输入过压","relayTwoName",false ,"Switch2", "电压"),
    guoYa_port3("2003","2203","输入过压","relayThreeName",false ,"Switch3", "电压"),
    guoYa_port4("2004","2204","输入过压","relayFourName",false ,"Switch4", "电压"),
    qianYa_port1("2005","2205","输入欠压","relayOneName",false ,"Switch1", "电压"),
    qianYa_port2("2006","2206","输入欠压","relayTwoName",false ,"Switch2", "电压"),
    qianYa_port3("2007","2207","输入欠压","relayThreeName",false ,"Switch3", "电压"),
    qianYa_port4("2008","2208","输入欠压","relayFourName",false ,"Switch4", "电压"),

    guoLiu_port1_A("1022","1222","输出A过流","relayOneName",true ,"Switch1", "电流"),
    guoLiu_port1_B("1023","1223","输出B过流","relayOneName",true,"Switch1", "电流"),
    guoLiu_port1_C("1024","1224","输出C过流","relayOneName",true,"Switch1", "电流"),
    guoLiu_port2_A("1025","1225","输出A过流","relayTwoName",true,"Switch2", "电流"),
    guoLiu_port2_B("1026","1226","输出B过流","relayTwoName",true,"Switch2", "电流"),
    guoLiu_port2_C("1027","1227","输出C过流","relayTwoName",true,"Switch2", "电流"),
    guoLiu_port3_A("1028","1228","输出A过流","relayThreeName",true,"Switch3", "电流"),
    guoLiu_port3_B("1029","1229","输出B过流","relayThreeName",true,"Switch3", "电流"),
    guoLiu_port3_C("1030","1230","输出C过流","relayThreeName",true,"Switch3", "电流"),
    guoLiu_port4_A("1031","1231","输出A过流","relayFourName",true,"Switch4", "电流"),
    guoLiu_port4_B("1032","1232","输出B过流","relayFourName",true,"Switch4", "电流"),
    guoLiu_port4_C("1033","1233","输出C过流","relayFourName",true,"Switch4", "电流"),
    qianLiu_port1_A("1034","1234","输出A欠流","relayOneName",true,"Switch1", "电流"),
    qianLiu_port1_B("1035","1235","输出B欠流","relayOneName",true,"Switch1", "电流"),
    qianLiu_port1_C("1036","1236","输出C欠流","relayOneName",true,"Switch1", "电流"),
    qianLiu_port2_A("1037","1237","输出A欠流","relayTwoName",true,"Switch2", "电流"),
    qianLiu_port2_B("1038","1238","输出B欠流","relayTwoName",true,"Switch2", "电流"),
    qianLiu_port2_C("1039","1239","输出C欠流","relayTwoName",true,"Switch2", "电流"),
    qianLiu_port3_A("1040","1240","输出A欠流","relayThreeName",true,"Switch3", "电流"),
    qianLiu_port3_B("1041","1241","输出B欠流","relayThreeName",true,"Switch3", "电流"),
    qianLiu_port3_C("1042","1242","输出C欠流","relayThreeName",true,"Switch3", "电流"),
    qianLiu_port4_A("1043","1243","输出A欠流","relayFourName",true,"Switch4", "电流"),
    qianLiu_port4_B("1044","1244","输出B欠流","relayFourName",true,"Switch4", "电流"),
    qianLiu_port4_C("1045","1245","输出C欠流","relayFourName",true,"Switch4", "电流"),
    guoLiu_port1("2009","2209","输出过流","relayOneName",true,"Switch1", "电流"),
    guoLiu_port2("2010","2210","输出过流","relayTwoName",true,"Switch2", "电流"),
    guoLiu_port3("2011","2211","输出过流","relayThreeName",true,"Switch3", "电流"),
    guoLiu_port4("2012","2212","输出过流","relayFourName",true,"Switch4", "电流"),
    qianLiu_port1("2013","2213","输出欠流","relayOneName",true,"Switch1", "电流"),
    qianLiu_port2("2014","2214","输出欠流","relayTwoName",true,"Switch2", "电流"),
    qianLiu_port3("2015","2215","输出欠流","relayThreeName",true,"Switch3", "电流"),
    qianLiu_port4("2016","2216","输出欠流","relayFourName",true,"Switch4", "电流"),

    kongzai_port1("2017","2217","输出空载","relayOneName",true ,"Switch1", "电流"),
    kongzai_port2("2018","2218","输出空载","relayTwoName",true ,"Switch2", "电流"),
    kongzai_port3("2019","2219","输出空载","relayThreeName",true ,"Switch3", "电流"),
    kongzai_port4("2020","2220","输出空载","relayFourName",true ,"Switch4", "电流"),

    DyingGasp("8001","8201","断电告警",null,null,null, null),
    ControlBoard("8002","8202","控制板通信故障",null,null,null, null),
    AbnormalMetering("8003","8203","计量芯片异常",null,null,null, null);


    private String code;

    private String s_code;

    private String value;

    private String portName;

    private Boolean determine;

    private String switchFlag;

    private String flag;

    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public String getSCode() {
        return s_code;
    }

    public String getPortName() {
        return portName;
    }

    public Boolean getDetermine() {
        return determine;
    }

    public String getSwitchFlag() {
        return switchFlag;
    }
    public String getFlag() {
        return flag;
    }

    ControllerErrorCode(String code, String sCode, String value, String portName, Boolean determine , String switchFlag, String flag){
        this.code = code;
        this.value = value;
        this.s_code = sCode;
        this.portName = portName;
        this.determine = determine;
        this.switchFlag = switchFlag;
        this.flag = flag;
    }

    public static ControllerErrorCode getByCode(String code) {
        for (ControllerErrorCode e : ControllerErrorCode.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return null;
    }

    public static ControllerErrorCode getBySCode(String sCode) {
        for (ControllerErrorCode e : ControllerErrorCode.values()) {
            if (e.s_code.equals(sCode)) {
                return e;
            }
        }
        return null;
    }
}
