package com.hzs.common.core.enums;

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

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 前台菜单明细
 * @Author: jiang chao
 * @Time: 2022/11/16 16:45
 * @Classname: EMenuDetail
 * @PackageName: com.hzs.common.core.enums
 * @Description 目前H5的会员专区不是走的统一控制接口，此处需要添加注册、升级、复购等相关专区下面的子级，需要确认一下 ESpecialArea 是否需要同步添加
 */
@AllArgsConstructor
@Getter
public enum EMenuDetail {

    //////////////////// 首页 ////////////////////

    I_NEW_ACHIEVEMENT(102, "新增业绩", "", EnumsPrefixConstants.E_MENU + "102", "iNewAchievement", 10),
    I_HONOR_AWARD(103, "荣誉奖衔", "", EnumsPrefixConstants.E_MENU + "103", "iHonorAward", 10),

    //////////////////// 会员专区 ////////////////////

    REGISTER(310, "报单专区", "", EnumsPrefixConstants.E_MENU + "310", "regiest", 30),
    REGISTER_FORM(315, "报单加盟", "报单加盟", EnumsPrefixConstants.E_MENU + "315", "regiestArea", 30),
    REGISTER_CONSUMPTION(316, "特价产品(0Pv)", "特价产品(0Pv)", EnumsPrefixConstants.E_MENU + "316", "registerConsumption", 30),

    UPGRADE(320, "消费专区", "", EnumsPrefixConstants.E_MENU + "320", "upgrade", 30),
    UPGRADE_FORM(325, "累计消费", "累计消费", EnumsPrefixConstants.E_MENU + "325", "upgradeArea", 30),
    UPGRADE_CONSUMPTION(326, "商品消费", "商品消费", EnumsPrefixConstants.E_MENU + "326", "upgradeConsumption", 30),

    RESALE_AREA(390, "复消专区", "复消专区", EnumsPrefixConstants.E_MENU + "390", "resaleArea", 30),
    RENEWAL_AREA(393, "年包专区", "年包专区", EnumsPrefixConstants.E_MENU + "393", "renewalArea", 30),

    FRAME(380, "会员架构", "", EnumsPrefixConstants.E_MENU + "380", "frame", 30),
    ARCHITECTURE(381, "安置架构", "", EnumsPrefixConstants.E_MENU + "381", "architecture", 30),
    RECOMMEND(382, "推荐架构", "", EnumsPrefixConstants.E_MENU + "382", "recommend", 30),

    //////////////////// 市场动态 ////////////////////

    ACHIEVEMENT(510, "月度分布", "", EnumsPrefixConstants.E_MENU + "510", "marketDynamics", 50),
    CONSANGUINITY_ACHIEVEMENT(511, "直推业绩", "", EnumsPrefixConstants.E_MENU + "511", "ConsanguinityCheck", 50),
    RESETTLE_IMAGE(512, "最末节点", "", EnumsPrefixConstants.E_MENU + "512", "placementChart", 50),
    MONTH_STATISTICS(513, "月度新增统计", "", EnumsPrefixConstants.E_MENU + "513", "monthlyChart", 50),
    MONTH_ACHIEVEMENT(514, "月度新增业绩", "", EnumsPrefixConstants.E_MENU + "514", "monthlyPerformance", 50),
    RECOMMEND_TIME(515, "推荐平均用时", "", EnumsPrefixConstants.E_MENU + "515", "recommendTime", 50),
    RECOMMEND_ACHIEVEMENT(516, "直推业绩", "", EnumsPrefixConstants.E_MENU + "516", "recommendPerformance", 50),
    RECOMMEND_LIST(517, "推荐列表", "", EnumsPrefixConstants.E_MENU + "517", "recommendList", 50),

    ACTIVITY(520, "活动专区", "", EnumsPrefixConstants.E_MENU + "520", "activeZone", 50),

    BONUS_DETAIL(530, "奖金明细", "", EnumsPrefixConstants.E_MENU + "530", "incomeDetail", 50),
    FIRST_PURCHASE_INCOME(531, "首购收益", "", EnumsPrefixConstants.E_MENU + "531", "firstPurchase", 50),
    REPURCHASE_INCOME(532, "复购收益", "", EnumsPrefixConstants.E_MENU + "532", "repurchaseEarnings", 50),
    BONUS_TOTAL(538, "实时收益", "", EnumsPrefixConstants.E_MENU + "538", "bonusTotal", 50),

    BONUS_SOURCE(540, "奖金来源", "", EnumsPrefixConstants.E_MENU + "540", "bonusSource", 50),

    CHECK_DETAIL(560, "考核明细", "", EnumsPrefixConstants.E_MENU + "560", "appraisal", 50),
    REPURCHASE_CHECK(561, "复购考核", "", EnumsPrefixConstants.E_MENU + "561", "repurchaseCheck", 50),
    DIVIDEND_CHECK(562, "分红考核", "", EnumsPrefixConstants.E_MENU + "562", "dividendCheck", 50),

    REGISTER_LIST(570, "注册列表", "", EnumsPrefixConstants.E_MENU + "570", "registration", 50),

    ATTRACT_LIST(580, "招商列表", "", EnumsPrefixConstants.E_MENU + "580", "investment", 50),
    DIRECT_LIST(581, "直推列表", "", EnumsPrefixConstants.E_MENU + "581", "directList", 50),

    //////////////////// 会员中心 ////////////////////

    MY_WALLET(901, "我的钱包", "", EnumsPrefixConstants.E_MENU + "901", "wallet", 90),

    MY_ORDER(902, "我的订单", "", EnumsPrefixConstants.E_MENU + "902", "order", 90),

    ;

    /**
     * 实际值
     */
    private final int value;
    /**
     * 显示标签
     */
    private final String label;
    /**
     * 显示标签别名
     */
    private final String labelAlias;
    /**
     * 国际化翻译key值
     */
    private final String key;
    /**
     * 菜单key
     */
    private final String menuKey;
    /**
     * 上级菜单（EMenu）
     */
    private final int parent;

    /**
     * 根据上级菜单获取菜单列表
     *
     * @param parent 上级菜单（EMenu）
     * @return
     */
    public static List<EMenuDetail> getEnumListByParent(int parent) {
        List<EMenuDetail> resultList = new ArrayList<>();
        for (EMenuDetail value : EMenuDetail.values()) {
            if (value.getParent() == parent) {
                resultList.add(value);
            }
        }
        return resultList;
    }


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

}
