package com.jxy.order.enums;

public enum UserLevel {
    REGISTERED(2, "registered", "L2"),
    ADVANCE(3, "advance", "L3"),
    VIP(4, "vip", "L4");

    private final long roleId;
    private final String role;
    private final String level;

    UserLevel(long roleId, String role, String level)
    {
        this.roleId = roleId;
        this.role = role;
        this.level = level;
    }

    public long getRoleId()
    {
        return roleId;
    }

    public String getRole()
    {
        return role;
    }

    public String getLevel(){return level;}

    public static String getLevelByRoleId(long roleId){
        for (UserLevel u : UserLevel.values()) {
            if(u.getRoleId()==roleId){
                return u.getLevel();
            }
        }
        return "";
    }
}
