package com.hzs.common.core.enums;

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

/**
 * @Description: 前台菜单
 * @Author: jiang chao
 * @Time: 2022/11/16 16:36
 * @Classname: EMenu
 * @PackageName: com.hzs.common.core.enums
 */
@AllArgsConstructor
@Getter
public enum EMenu {

    INDEX(10, "首页", EnumsPrefixConstants.E_MENU + "10", "index"),

    PRODUCT(30, "会员专区", EnumsPrefixConstants.E_MENU + "30", "product"),

    MARKET(50, "市场动态", EnumsPrefixConstants.E_MENU + "50", "market"),

    MEMBER(90, "会员中心", EnumsPrefixConstants.E_MENU + "90", "center"),

    ;

    /**
     * 实际值
     */
    private final int value;
    /**
     * 显示标签
     */
    private final String label;
    /**
     * 国际化翻译key值
     */
    private final String key;
    /**
     * 菜单key
     */
    private final String menuKey;

    /**
     * 根据枚举值获取枚举
     *
     * @param value
     * @return
     */
    public static EMenu getEnumByValue(int value) {
        for (EMenu enums : EMenu.values()) {
            if (enums.getValue() == value) {
                return enums;
            }
        }
        return null;
    }

}
