package org.well.well.AlarmEnumDTO;

/**
 * Created by admin on 2017/4/6.
 */
public enum LampAlarmEnum {

    LampChannel1TurnOnFail("通道一开灯异常", "1"),
    LampChannel1TurnOffFail("通道一关灯异常", "2"),
    LampChannel1LowElectricityAlarm ("通道一电流低于阈值告警", "3"),
    LampChannel1Unknown  ("通道一未知异常", "4"),
    LampChannel2TurnOnFail("通道二开灯异常", "5"),
    LampChannel2TurnOffFail("通道二关灯异常", "6"),
    LampChannel2LowElectricityAlarm("通道二电流低于阈值告警", "7"),
    LampChannel2Unknown("通道二未知异常", "8");
    // 成员变量
    private String name;
    private String index;

    // 构造方法
    private LampAlarmEnum(String name, String index) {
        this.name = name;
        this.index = index;
    }

    //覆盖方法
    @Override
    public String toString() {
        return this.name;
    }

    public String getIndex() {
        return index;
    }

    public String getName() {
        return name;
    }

    public static LampAlarmEnum getByIndex(String index) {
        try {
            for (LampAlarmEnum temp : values()) {
                if (temp.index.equals(index)) {
                    return temp;
                }
            }
        } catch (Exception e) {
        }
        return null;
    }


}
