package com.mvc.constant;

/**
 * 燃气表报警类型
 */
public enum GasAlarmType {
    UNKNOWN(0, "未知"),
    STANDARD_BELOW(1, "低于标准"),
    STANDARD_ABOVE(2, "高于标准"),
    SUBSCRIBE_BELOW(3, "低于订阅标准"),
    SUBSCRIBE_ABOVE(4, "高于订阅标准"),
    DYNAMIC_BELOW(5, "低于动态标准"),
    DYNAMIC_ABOVE(6, "高于动态标准"),
    DATA_MISSING(7, "数据缺失"),
    IMAGE_MISSING(8, "图像缺失");

    private Integer flag;
    private String desc;

    GasAlarmType(Integer flag, String desc) {
        this.flag = flag;
        this.desc = desc;
    }

    public Integer getFlag() {
        return flag;
    }

    public void setFlag(Integer flag) {
        this.flag = flag;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static GasAlarmType findGasAlarmTypeByflag(Integer flag) {
        for (GasAlarmType alarmType : GasAlarmType.values()) {
            if (alarmType.flag.intValue() == flag.intValue()) {
                return alarmType;
            }
        }
        return null;
    }
}
