package com.mvc.constant;

/**
 * 升级计划状态
 */
public enum UpgradePlanStatus {
    INCOMPLETE("0","未完成"),
    SUCCESS("1","[完成]全部成功"),
    FAIL("2","[完成]部分成功"),
    MISMATCH("3","[完成]全部失败"),
    MANUAL_TERMINATION("4","[终止]手动终止")
    ;

    private String flag;
    private String desc;

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

    public String getFlag() {
        return flag;
    }

    public String getDesc() {
        return desc;
    }

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