package com.njcn.user.enums;

/**
 * @author hongawen
 * @date: 2019/10/28 15:11
 */
public enum UserLevelEnum {

    HOST_USER("0","主用户"),
    CHILD_USER("1","子用户"),
    OPERATION_USER("2","运维"),
    SPECIFIC_USER("3","专职"),
    ENGINEERING_USER("4","工程"),
    TOURIST_USER("5","游客");

    private String code;

    private String msg;

    UserLevelEnum(String code, String msg){
        this.code=code;
        this.msg=msg;
    }

    public String getCode(){
        return code;
    }

    public String getMsg(){
        return msg;
    }

    public static String getMsgByCode(String code){
        for (UserLevelEnum userLevelEnum : UserLevelEnum.values()) {
            if (userLevelEnum.code.equalsIgnoreCase(code)) {
                return userLevelEnum.msg;
            }
        }
        return "";
    }


    public static String getCodeByMsg(String msg){
        for (UserLevelEnum userLevelEnum : UserLevelEnum.values()) {
            if (userLevelEnum.msg.equalsIgnoreCase(msg)) {
                return userLevelEnum.code;
            }
        }
        return "";
    }
}
