package org.well.well.AlarmEnumDTO;

/**
 * @author cz
 * @date 2023-11-10
 */
public enum PressureAlarmEnum {

    NO_DATA("设备异常", -1),

    NORMAL("正常", 0),

    OVER_THRESH("压力超限", 1),

    PressureCommunicationFailure("压力传感器通讯失败", 2),

    PressureError("压力传感器异常", 3),

    PressureUnknown("压力未知异常", 4),

    OVER_THRESH1("一级压力超限", 5),

    OVER_THRESH2("二级压力超限", 6);

    // 成员变量
    private String name;
    private int index;

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

    public int getIndex() {
        return this.index;
    }

    public String getName() {
        return this.name;
    }

    public static PressureAlarmEnum getByIndex(String index) {
        try {
            for (PressureAlarmEnum temp : values()) {
                if (temp.index == Integer.parseInt(index)) {
                    return temp;
                }
            }
        } catch (Exception e) {
        }
        return null;
    }

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


}
