package com.mvc.constant;

/**
 * 运行/投运状态
 */
public enum OperationStatus {
    NOT_INSTALLED("0", "未安装"),
    INSTALLED("1", "已安装"),
    CONFIGURED("2", "已配置"),
    OPERATIONAL("3", "已投运"),
    CONFIG_INVALID("4", "已投运."),//注意:现在把配置失效也作为已投运状态中的一种特殊状态 2025-05-22 guozhao
    OBSOLETED("9","已过时")
    ;

    private String flag;
    private String desc;

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

    public String getFlag() {
        return flag;
    }

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

    public String getDesc() {
        return desc;
    }

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

    public static OperationStatus findOperationStatusByflag(String flag){
        for (OperationStatus state: OperationStatus.values()) {
            if (state.flag.equals(flag)) {
                return  state;
            }
        }
        return null;
    }
}
