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.Arrays;
import java.util.List;

/**
 * 前台菜单明细
 * 目前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),

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

//    SHARE(301, "分享专区", "", EnumsPrefixConstants.E_MENU + "301", "share", 30),
//    FANS(302, "海粉分享", "", EnumsPrefixConstants.E_MENU + "302", "hiFans", 30),
//    SEA(303, "免费注册", "", EnumsPrefixConstants.E_MENU + "303", "haiFans", 30),

    REGISTER(310, "注册专区", "", EnumsPrefixConstants.E_MENU + "310", "regiest", 30),
    REGISTER_AREA(311, "自营专区", "自营专区(注册)", EnumsPrefixConstants.E_MENU + "311", "regiestArea", 30),
    REGISTER_LXYK(312, "注册专区", "乐学易考(注册)", EnumsPrefixConstants.E_MENU + "312", "ezLearnReg", 30),

    UPGRADE(320, "升级专区", "", EnumsPrefixConstants.E_MENU + "320", "upgrade", 30),
    UPGRADE_AREA(321, "自营专区", "自营专区(升级)", EnumsPrefixConstants.E_MENU + "321", "upgradeArea", 30),
    UPGRADE_LXYK(322, "升级专区", "乐学易考(升级)", EnumsPrefixConstants.E_MENU + "322", "ezLearnUp", 30),
//    UPGRADE_HAI_FUN(323, "海粉专区", "海粉专区(升级)", EnumsPrefixConstants.E_MENU + "323", "haiFunUpd", 30),

    REPURCHASE(330, "复购专区", "", EnumsPrefixConstants.E_MENU + "330", "repurchase", 30),
    SELF_SUPPORT(331, "自营专区", "自营专区(复购)", EnumsPrefixConstants.E_MENU + "331", "self", 30),
    //    REPURCHASE_SEA(336, "三方供应", "三方供应", EnumsPrefixConstants.E_MENU + "336", "hiFansRepurchase", 30),
    COOPERATE(332, "复购合作", "", EnumsPrefixConstants.E_MENU + "332", "cooperation", 30),
    //    CLOUD(333, "工具流", "", EnumsPrefixConstants.E_MENU + "333", "gongju", 30),
//    LIVE(334, "直播专区", "", EnumsPrefixConstants.E_MENU + "334", "live", 30),
    REPURCHASE_LXYK(335, "乐学甄选", "乐学易考(复购)", EnumsPrefixConstants.E_MENU + "335", "ezLearnRep", 30),

    WELFARE_AREA(340, "福利专区", "", EnumsPrefixConstants.E_MENU + "340", "welfare", 30),

//    INTEGRAL_AREA(350, "积分专区", "", EnumsPrefixConstants.E_MENU + "350", "integral", 30),

    REPEATED_CONSUMPTION(360, "重消专区", "", EnumsPrefixConstants.E_MENU + "360", "rescission", 30),

    RENEWAL_AREA(364, "续约专区", "", EnumsPrefixConstants.E_MENU + "364", "renewalArea", 30),

//    WHOLESALE_AREA(365, "专供专区", "", EnumsPrefixConstants.E_MENU + "365", "wolesaleArea", 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_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),
    FANS_INCOME(533, "海粉收益", "", EnumsPrefixConstants.E_MENU + "533", "hignFans", 50),
    REPURCHASE_COUPON_INCOME(536, "复购券收益", "", EnumsPrefixConstants.E_MENU + "536", "repurchaseTicket", 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),
    ATTRACT_DETAIL_LIST(582, "三单循环", "", EnumsPrefixConstants.E_MENU + "582", "attractDetailList", 50),
//    HAI_LIST(583, "免费注册", "", EnumsPrefixConstants.E_MENU + "583", "haiList", 50),

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

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

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

//    STATISTICAL_ANALYSIS(903, "统计分析", EnumsPrefixConstants.E_MENU + "903", "statistics", 90),

    PICK(904, "提货专区", "", EnumsPrefixConstants.E_MENU + "904", "pickGoods", 90),

    SELF_HELP(905, "自助服务", "", EnumsPrefixConstants.E_MENU + "905", "selfHelp", 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;
    }


    /**
     * 特殊用户展示
     *
     * @return
     */
    public static List<Integer> specialList() {
        return Arrays.asList(
                EMenuDetail.REGISTER.value,
                EMenuDetail.REGISTER_AREA.value,

                EMenuDetail.UPGRADE.value,
                EMenuDetail.UPGRADE_AREA.value,

                EMenuDetail.REPURCHASE.value,
                EMenuDetail.SELF_SUPPORT.value,
                EMenuDetail.COOPERATE.value,

                EMenuDetail.MY_ORDER.value,
                EMenuDetail.PICK.value,
                EMenuDetail.SELF_HELP.value
        );
    }

}
