package com.ruoyi.common.enums;

import lombok.Data;
import lombok.Getter;

@Getter
public enum MemberLevel {
    NEW_PARENTS(1, "新晋家长"),
    ORDINARY_MEMBER(2, "普卡会员"),
    SILVER_MEMBER(3, "银卡会员"),
    GOLD_MEMBER(4, "金卡会员");

    private final Integer code;
    private final String name;

    private MemberLevel(Integer code, String name) {
        this.code = code;
        this.name = name;
    }
    public static String getName(Integer code) {
        for (MemberLevel memberLevel : values()) {
            if (memberLevel.getCode().equals(code)) {
                return memberLevel.getName();
            }
        }
        return "";
    }

    public static Integer getCode(String name) {
        for (MemberLevel memberLevel : values()) {
            if (memberLevel.getName().equals(name)) {
                return memberLevel.getCode();
            }
        }
        return null;
    }
}
