package com.mvc.constant;

/**
 * 设备升级状态
 */
public enum DeviceUpgradeStatus {
    UNKNOW("-1","-"),
    UNEXECUTED("0","待执行"),
    SUCCESS("1","成功"),
    FAIL("2","失败"),
    MISMATCH("3","版本不匹配"),
    OVERDUE("4","超期未执行"),
    LOW_VOLTAGE("5","电压过低"),
    DEVICE_CANCEL("6","设备取消"),
    DEVICE_WRITE_FAIL("7","写入失败")
    ;

    private String flag;
    private String desc;

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

    public String getFlag() {
        return flag;
    }

    public String getDesc() {
        return desc;
    }

    public static DeviceUpgradeStatus getDeviceUpgradeStatusByFlag(String flag){
        for (DeviceUpgradeStatus status : DeviceUpgradeStatus.values()) {
            if (status.flag.equals(flag)) {
                return status;
            }
        }
        return null;
    }
}
