package com.qiuguo.iot.base.enums;

/*
* OTA模式类型
* 作者：吴林
* */
// 0：手动升级 1：自动升级 2强制升级
public enum OtaModeEnum {
    USER_CONTROL(0, "手动升级"),
    AUTO(1, "自动"),
    FORCE(2, "强制"),
    ;
     OtaModeEnum(Integer c, String n){
        code = c;
        name = n;
    }
    private Integer code;
    private String name;
    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static OtaModeEnum getEnumWithCode(Integer c){
        for (OtaModeEnum e:values()
        ) {
            if(e.getCode().compareTo(c) == 0){
                return e;
            }
        }
        return null;
    }
    public static OtaModeEnum getEnumWithName(String name){
        for (OtaModeEnum e:values()
        ) {
            if(e.getName().equals(name)){
                return e;
            }
        }
        return null;
    }
}
