package com.schisandra.auth.common.enums;

import lombok.Getter;

@Getter
public enum UserRoleEnum {

    NORMAL_USER(1L,"普通用户"),
    ADMIN(2L,"管理员"),
    SUPER_ADMIN(3L,"超级管理员");

    public Long code;

    public String desc;

    UserRoleEnum(Long code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public static UserRoleEnum getByCode(int codeVal){
        for(UserRoleEnum resultCodeEnum : UserRoleEnum.values()){
            if(resultCodeEnum.code == codeVal){
                return resultCodeEnum;
            }
        }
        return null;
    }
}
