package com.ytpm.agent.enums;

import lombok.Getter;

/**
 * 用户状态枚举类
 */
@Getter
public enum UserStatusEnum {
    NORMAL(1,"正常"),
    LOCK(2, "锁定"),
    RISK(3, "封禁"),
    LOGOUT(4, "注销"),
    VISITOR_LOCK(5, "登陆前封禁"),
    ;

    private final Integer code;
    private final String desc;

    UserStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据编码获取状态
     */
    public static String getByCode(Integer code){
        for (UserStatusEnum value : UserStatusEnum.values()) {
            if(!value.getCode().equals(code))continue;
            return value.getDesc();
        }
        return "";
    }

}
