package com.njcn.cloud.enums.app;

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

    HOST_USER("0","主用户"),NORMAL_USER("1","普通用户"),VIP1_USER("2","用户VIP1");

    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 "";
    }
}
