package com.mvc.constant;

/**
 * MCU程序版本
 */
public enum McuSoftVer {
    MCU_AA("aa","1021"),
    MCU_AB("ab","蓝壳新程序"),
    MCU_EC("ec","ESP32")
    ;


    private String flag;
    private String desc;

    McuSoftVer(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 McuSoftVer findMcuSoftVerByflag(String flag){
        if(flag==null) return null;
        flag = flag.toLowerCase();
        for (McuSoftVer mcuSoftVer: McuSoftVer.values()) {
            if (flag.startsWith(mcuSoftVer.flag)) {
                return  mcuSoftVer;
            }
        }
        return null;
    }
}
