package org.well.well.AlarmEnumDTO;

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

    LamphouseTurnOnFail("闭合异常", "1"),
    LamphouseTurnOffFail("断开异常", "2"),
    LamphouseLowElectricityAlarm("电流低于阈值告警", "3"),
    LamphouseUnknown("灯箱控制器未知异常", "4");
    // 成员变量
    private String name;
    private String index;

    // 构造方法
    private LampHouseAlarmEnum(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 LampHouseAlarmEnum getByIndex(String index) {
        try {
            for (LampHouseAlarmEnum temp : values()) {
                if (temp.index.equals(index)) {
                    return temp;
                }
            }
        } catch (Exception e) {
        }
        return null;
    }


}
