package com.hzs.common.core.enums;

import com.hzs.common.core.constant.EnumsPrefixConstants;
import com.hzs.common.core.constant.MemberFrameworkConstants;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 等级设置
 */
@AllArgsConstructor
@Getter
public enum EGrade {

    /**
     * -3=虚拟
     */
    VIRTUALLY(-3, 0, "虚拟", 1, EnumsPrefixConstants.ENU_CAT + 3, MemberFrameworkConstants.xuni),
    /**
     * 1=待激活 死点 撤单
     */
    DEAD_POINT(-1, 0, "待激活", 1, EnumsPrefixConstants.ENU_CAT + 1, MemberFrameworkConstants.toBeActivated),
    /**
     * 2=已注销 退单
     */
    LOGGED_OUT(-2, 0, "已注销", 1, EnumsPrefixConstants.ENU_CAT + 2, MemberFrameworkConstants.LOG_OFF),

    /**
     * 顾客
     */
    START_UP(1, 20, "V0", 0, EnumsPrefixConstants.GRADE + "20", MemberFrameworkConstants.START_UP),

    /**
     * VIP
     */
    HAI_FAN(2, 30, "V1", 0, EnumsPrefixConstants.GRADE + "30", MemberFrameworkConstants.Hi_Pink),

    /**
     * SVIP
     */
    YOU_KE(3, 40, "V2", 0, EnumsPrefixConstants.GRADE + "40", MemberFrameworkConstants.YOU_KE),

    /**
     * 卓越
     */
    MAKER(4, 50, "V3", 0, EnumsPrefixConstants.GRADE + "50", MemberFrameworkConstants.MAKER),

    /**
     * 首席
     */
    VIP(5, 60, "V4", 0, EnumsPrefixConstants.GRADE + "60", MemberFrameworkConstants.VIP),

    /**
     * 合伙人
     */
    S_VIP(6, 70, "V5", 0, EnumsPrefixConstants.GRADE + "70", MemberFrameworkConstants.S_VIP),

    ;

    /**
     * 序号
     */
    private final int index;
    /**
     * 实际值
     */
    private final int value;

    /**
     * 显示标签
     */
    private final String label;
    /**
     * 是否启用（0=是,1=否） -- 来源EYesNo
     */
    private final int enable;
    /**
     * 国际化翻译key值
     */
    private final String key;

    /**
     * 头像地址
     */
    private final String imageUrl;

    public static EGrade getGrade(int value) {
        for (EGrade eGrade : EGrade.values()) {
            if (value == eGrade.value) {
                return eGrade;
            }
        }
        return null;
    }


    public static String getGradeLabel(int value) {
        for (EGrade eGrade : EGrade.values()) {
            if (value == eGrade.value) {
                return eGrade.getLabel();
            }
        }
        return "";
    }

}
