package com.game.common.constant.finance;

import com.game.common.constant.ProjConfig;
import com.game.common.entity.KeyValue;
import com.game.common.utils.MessageUtils;

import java.util.ArrayList;

/**
 * @author jiang
 */

public enum FinTranType3 {
    /**
     * 未知的
     */
    TypeNone(FinTranType2.TypeNone, 0, "10986",0),
    /**
     * 充值 - 线上充值
     */
    ON_LINE_CHARGE(FinTranType2.CHARGE, 1001, "11275",0),
    /**
     * 充值 - 人工充值
     */
    CHARGE_IN(FinTranType2.CHARGE, 1101, MessageUtils.message("11212") + ProjConfig.getCoinName(),0),
    /**
     * 充值 - 后台充值
     */
    CHARGE_IN_Back(FinTranType2.CHARGE, 1108, "11276",0),
    /**
     * 充值 - 扣除金币
     */
    CHARGE_OUT(FinTranType2.CHARGE, 1102, MessageUtils.message("11277") + ProjConfig.getCoinName(),0),

    /**
     * 游戏 - 游戏奖励
     */
    CHARGE_WIN_GAME(FinTranType2.GAME_REWARD, 1103, "11215",0),

    /**
     * 充值 - 扣除手续费
     */
    CHARGE_OUT_RATE(FinTranType2.CHARGE, 1104, MessageUtils.message("11277") + ProjConfig.getD_ticketName(),0),

    /**
     * 充值 - 赠送
     */
    CHARGE_IN_SEND(FinTranType2.CHARGE, 1106, MessageUtils.message("11277") + ProjConfig.getD_ticketName(),0),

    /**
     * 分红 - 代理分红
     */
    AGENT_DIVIDED(FinTranType2.REWARD_Income, 1105, "11575",0),

    /**
     * 活动 - 首充奖励
     */
    FIRST_CHARGE_REWARD(FinTranType2.REWARD_Income, 1201, "11278",0),
    /**
     * 活动 - 新手大礼包
     */
    NEW_USER_GIFT_PACKAGE(FinTranType2.REWARD_Income, 1202, "11279",0),
    /**
     * 活动 - 购买贵族赠送金币收益
     */
    INCOIN_BUY_NOBLE_REWARD(FinTranType2.REWARD_Income, 1203, "11280",0),
    /**
     * 活动 - 等级礼包
     */
    INCOIN_GRADE_GIFT_PACKAGE(FinTranType2.REWARD_Income, 1204, "11281",0),
    /**
     * 活动 - 连续登录奖励
     */
    CONTINUE_LOGIN_REWARD(FinTranType2.REWARD_Income, 1205, "11282",0),
    /**
     * 活动 - 签到奖励
     */
    SIGN_IN_REWARD(FinTranType2.REWARD_Income, 1206, "11032",0),
    /**
     * 活动 - 充值奖励
     */
    CHARGE_IN_REWARD(FinTranType2.REWARD_Income, 1207, "11283",0),

    /**
     * 活动 - 邀请奖励
     */
    CHARGE_IN_INVITE(FinTranType2.REWARD_Income, 1208, "11576",0),

    /**
     * 兑换 - 佣金兑换金币
     */
    AMOUNT_TO_COIN(FinTranType2.EXCHANGE_COIN, 1301, MessageUtils.message("11284") + ProjConfig.getCoinName(),0),
    /**
     * 兑换 - 映票兑换金币
     */
    Ticket_TO_COIN(FinTranType2.EXCHANGE_COIN, 1302, ProjConfig.getTicketName() + MessageUtils.message("11214") + ProjConfig.getCoinName(),0),
    /**
     * 兑换 - 余额兑换金币
     */
    DiamondCoin_TO_COIN(FinTranType2.EXCHANGE_COIN, 1303, ProjConfig.getD_ticketName() + MessageUtils.message("11214") + ProjConfig.getCoinName(),0),
    /**
     * 兑换 - 金币兑换余额
     */
    COIN_TO_DiamondCoin(FinTranType2.EXCHANGE_COIN, 1304, ProjConfig.getCoinName() + MessageUtils.message("11214") + ProjConfig.getD_ticketName(),0),

    /**
     * 兑换 - 余额兑换实物
     */
    COIN_TO_SHOP(FinTranType2.EXCHANGE_COIN, 1305, ProjConfig.getCoinName() + MessageUtils.message("11214") + MessageUtils.message("11574"),0),

    /**
     * 转账 - 团队余额转账
     */
    TRANSFER_TO_TEAM_DiamondCoin(FinTranType2.USER_TRANSFER, 1601, "团队余额转账",0),

    /**
     * 转账 - 金币转账
     */
    TRANSFER_TO_Coin(FinTranType2.USER_TRANSFER, 1602, "金币转账",0),

    /**
     * 赠送礼物 - 直播房间内
     */
    CONSUM_LIVE_ROOM_REWARD(FinTranType2.CONSUM_SEND_GIFT, 2001, "11285",1),
    /**
     * 赠送礼物 - 短视频打赏
     */
    CONSUM_NEWS_REWARD(FinTranType2.CONSUM_SEND_GIFT, 2002, "11286",1),
    /**
     * 赠送礼物 - 聊天打赏
     */
    CONSUM_CHAT_REWARD(FinTranType2.CONSUM_SEND_GIFT, 2003, "11287",1),
    /**
     * 赠送礼物 - 通话打赏
     */
    CONSUM_O2O_CALL_REWARD(FinTranType2.CONSUM_SEND_GIFT, 2004, "11288",1),
    /**
     * 赠送礼物 - 个人主页打赏
     */
    CONSUM_PERSONAL_HOME_PAGE_REWARD(FinTranType2.CONSUM_SEND_GIFT, 2005, "11289",1),
    /**
     * 赠送礼物 - 幸运礼物
     */
    CONSUM_LUCKY_GIFT_REWARD(FinTranType2.CONSUM_SEND_GIFT, 2006, "11290",1),
    /**
     * 赠送礼物 - 长视频
     */
    CONSUM_TELEVISION_VIDEO_REWARD(FinTranType2.CONSUM_SEND_GIFT, 2007, "11291",1),

    /**
     * 付费功能 - 点歌
     */
    CONSUM_CHOOSE_SONG(FinTranType2.CONSUM_CHOOSE_SONG, 2101, "11217",1),
    /**
     * 付费功能 - 直播回放
     */
    CONSUM_PAY_COIN_LIVE_REPLAY(FinTranType2.CONSUM_PAY_COIN_LIVE_REPLAY, 2201, "11167",1),
    /**
     * 付费功能 - 私密视频
     */
    CONSUM_PRIVATE_VIDEO(FinTranType2.CONSUM_PRIVATE_VIEW, 2301, "11292",1),
    /**
     * 付费功能 - 私密图片
     */
    CONSUM_PRIVATE_IMG(FinTranType2.CONSUM_PRIVATE_VIEW, 2302, "11293",1),
    /**
     * 付费功能 - 守护
     */
    CONSUM_GUARD(FinTranType2.CONSUM_GUARD, 2401, "11219",1),
    /**
     * 付费功能 - 加入粉丝团
     */
    CONSUM_FANS_TEAM(FinTranType2.CONSUM_FANS_TEAM, 2501, "11294",1),
    /**
     * 付费功能 - 发送弹幕
     */
    CONSUM_PT_TEXT_BARRAGE(FinTranType2.CONSUM_SEND_BARRAGE, 2601, "11166",1),
    /**
     * 付费功能 - 购买贵族
     */
    CONSUM_BUY_NOBLE(FinTranType2.CONSUM_BUY_NOBLE, 2701, "11220",1),

    /**
     * 通话 - 视频通话
     */
    CONSUM_PAY_O2O_VIDEO(FinTranType2.CONSUM_PAY_COIN_1V1, 2801, "11295",1),
    /**
     * 通话 - 语音通话
     */
    CONSUM_PAY_O2O_VOICE(FinTranType2.CONSUM_PAY_COIN_1V1, 2802, "11296",1),
    /**
     * 通话 - 用户间通话
     */
    CONSUM_PAY_O2O_UU(FinTranType2.CONSUM_PAY_COIN_1V1, 2803, "11297",1),

    /**
     * 道具 - 购买坐骑
     */
    CONSUM_BUY_CAR(FinTranType2.CONSUM_BUY_PROP, 2901, "11298",1),

    /**
     * 道具 - 购买坐骑
     */
    CONSUM_BUY_MIC_SEAT(FinTranType2.CONSUM_BUY_PROP, 2903, "11299",1),
    /**
     * 道具 - 购买靓号
     */
    CONSUM_BUY_LIANG(FinTranType2.CONSUM_BUY_PROP, 2902, "11300",1),

    /**
     * 游戏 - 游戏消费
     */
    CONSUM_GAME_ANCHOR_ZHUANPAN(FinTranType2.CONSUM_GAME, 20001, "11222",0),

    /**
     * 游戏 - 游戏消费 (后台补充流水，用于满足提现条件)
     */
    CONSUM_GAME_ANCHOR_WITHDRAW(FinTranType2.CONSUM_GAME, 20002, "11577",0),

    /**
     * 红包 - 发红包
     */
    CONSUM_SEND_RED_PACKAGE(FinTranType2.CONSUM_RED_PACKAGE, 20101, "11245",0),
    /**
     * 红包 - 领红包
     */
    INCOIN_GET_RED_PACKAGE(FinTranType2.CONSUM_RED_PACKAGE, 20102, "11246",0),
    /**
     * 红包 - 红包退回
     */
    CONSUM_QUIT_RED_PACKAGE(FinTranType2.CONSUM_RED_PACKAGE, 20103, "11301",0),

    /**
     * 付费功能 - 查看手机号
     */
    CONSUM_WATCH_MOBILE(FinTranType2.CONSUM_WATCH_CONTACT, 20201, "11302",1),
    /**
     * 付费功能 - 查看微信号
     */
    CONSUM_WATCH_WECHAT(FinTranType2.CONSUM_WATCH_CONTACT, 20202, "11303",1),
    /**
     * 付费功能 - 购买SVIP
     */
    CONSUM_BUY_SVIP(FinTranType2.CONSUM_BUY_SVIP, 20401, "11225",1),

    /**
     * 付费功能 - 付费房间
     */
    CONSUM_ROOM_PAY(FinTranType2.CONSUM_ROOM_COIN, 20501, "11304",1),
    /**
     * 付费功能 - 计时房间
     */
    CONSUM_ROOM_TIME(FinTranType2.CONSUM_ROOM_COIN, 20502, "11305",1),
    /**
     * 付费功能 - 购买贵宾席
     */
    CONSUM_BUY_VIPSEATS(FinTranType2.CONSUM_BUY_VIPSEATS, 20702, "11227",1),
    /**
     * 付费功能 - 付费私信
     */
    CONSUM_CHAT_CHARGES(FinTranType2.CONSUM_CHAT_CHARGES, 20203, "11173",1),
    /**
     * 付费功能 - 百宝箱抽奖
     */
    CONSUM_TREASURE_CHEST(FinTranType2.CONSUM_LUCK_DRAW, 20703, "11306",1),

    /**
     * 佣金 - 注册佣金
     */
    RECOMMEND_REG_USER_AMOUNT(FinTranType2.RECOMMEND_AMOUNT, 5001, "11307",0),
    /**
     * 佣金 - 主播认证佣金
     */
    RECOMMEND_REG_ANCHOR_AMOUNT(FinTranType2.RECOMMEND_AMOUNT, 5002, "11308",0),
    /**
     * 佣金 - 签到佣金
     */
    RECOMMEND_SIGN_IN_AMOUNT(FinTranType2.RECOMMEND_AMOUNT, 1406, "11309",0),
    /**
     * 佣金 - 通话佣金
     */
    RECOMMEND_OOO_CALL_AMOUNT(FinTranType2.RECOMMEND_AMOUNT, 5003, "11310",0),
    /**
     * 佣金 - 打赏佣金
     */
    RECOMMEND_REWARD_AMOUNT(FinTranType2.RECOMMEND_AMOUNT, 5004, "11311",0),
    /**
     * 佣金 - 补发佣金
     */
    RECOMMEND_ADD_AMOUNT(FinTranType2.RECOMMEND_AMOUNT, 5005, "11312",0),
    /**
     * 佣金 - 用户充值
     */
    RECOMMEND_USER_RECHARGE(FinTranType2.RECOMMEND_AMOUNT, 5006, "11313",0),
    /**
     * 佣金 - 购买贵族佣金
     */
    RECOMMEND_BUY_NOBLE(FinTranType2.RECOMMEND_AMOUNT, 5007, "11314",0),
    /**
     * 佣金 - 购买SVIP佣金
     */
    RECOMMEND_BUY_SVIP(FinTranType2.RECOMMEND_AMOUNT, 5008, "11315",0),
    /**
     * 佣金 - 盲盒
     */
    RECOMMEND_BUY_BLIND_BOX(FinTranType2.RECOMMEND_AMOUNT, 5009, "11316",0),


    /**
     * 佣金提现 - 用户佣金提现
     */
    CASH_USER_AMOUNT(FinTranType2.CASH, 6001, "11317",0),
    /**
     * 佣金提现 - 代理佣金提现
     */
    CASH_AGENT_AMOUNT(FinTranType2.CASH, 6002, "11318",0),

    /**
     * 映票提现 - 主播收益提现
     */
    CASH_ANCHOR_INCOME(FinTranType2.CASH, 6003, "11319",0),
    /**
     * 映票提现 - 公会佣金提现
     */
    CASH_GUILD_INCOME(FinTranType2.CASH, 6004, "11320",0),
    /**
     * 映票提现 - 商家收益提现
     */
    CASH_BUSINESS_INCOME(FinTranType2.CASH, 6005, "11321",0),

    /**
     * 余额提现 - 用户（主播）余额提现
     */
    CASH_DIAMOND_INCOME(FinTranType2.CASH, 6006, "11572",0),

    /**
     * 余额提现 - 审核回退
     */
    CASH_DIAMOND_INCOME_BACK(FinTranType2.CASH, 6007, "11578",0),

    /**
     * 寻觅 - 寻觅下单
     */
    SEEK_PLACE_ORDER(FinTranType2.SEEK_ORDER, 22001, "11322",0),
    /**
     * 寻觅 - 订单取消
     */
    SEEK_ORDER_CANCEL(FinTranType2.SEEK_ORDER, 22002, "11323",0),
    /**
     * 寻觅 - 订单拒绝
     */
    SEEK_ORDER_REFUSE(FinTranType2.SEEK_ORDER, 22003, "11324",0),
    /**
     * 寻觅 - 订单完结
     */
    SEEK_ORDER_FINISH(FinTranType2.SEEK_ORDER, 22004, "11325",0),

    /**
     * 电视剧 - 购买电视剧集
     */
    BUY_TV_VIDEO(FinTranType2.TV_VIDEO, 22101, "11326",0),
    /**
     * 打开盲盒
     */
    OPEN_BLIND_BOX(FinTranType2.BLIND_BOX, 22201, "11327",0),
    /**
     * 存盲盒
     */
    KEEP_BLIND_BOX(FinTranType2.BLIND_BOX, 22202, "11328",0),
    ;

    private FinTranType2 first;
    private int typeValue;
    private String typeName;
    private int tranType; // 交易类型 0：其他 1：直播

    static KeyValue[] m_KeyValueArr = null;

    public static KeyValue[] getKeyValues() {
        return getKeyValues(null);
    }

    public static KeyValue[] getKeyValues(Integer tranType) {
        if (m_KeyValueArr == null) {
            ArrayList<KeyValue> listKV = new ArrayList<KeyValue>();
            listKV.add(new KeyValue("", "全部", true));
            for (FinTranType3 m : FinTranType3.values()) {
                KeyValue kv = new KeyValue("" + m.typeValue, m.typeName);
                if(null == tranType){
                    listKV.add(kv);
                }else if(tranType.intValue() == m.tranType){
                    listKV.add(kv);
                }

            }
            m_KeyValueArr = listKV.toArray(new KeyValue[0]);
        }
        return m_KeyValueArr;
    }

    public static KeyValue[] getKeyValuesByType2(FinTranType2 type2) {

        ArrayList<KeyValue> listKV = new ArrayList<KeyValue>();
        listKV.add(new KeyValue("", "全部", true));
        for (FinTranType3 m : FinTranType3.values()) {
            if (m.getTranType2() == type2) {
                KeyValue kv = new KeyValue("" + m.typeValue, m.typeName);
                listKV.add(kv);
            }
        }
        return listKV.toArray(new KeyValue[0]);
    }


    FinTranType3(FinTranType2 first, int childType, String childName,int tranType) {
        this.first = first;
        this.typeName = childName;
        this.typeValue = childType;
        this.tranType = tranType;
    }

    public FinTranType2 getTranType2() {
        return first;
    }

    public int getType() {
        return typeValue;
    }

    public String getTypeName() {
        return typeName;
    }

    public int getCode() {
        return typeValue;
    }

    public String getName() {
        return typeName;
    }

    public static String getNameDescribe(int n) {
        for (FinTranType3 m : FinTranType3.values()) {
            if (m.typeValue == n) {
                return m.typeName;
            }
        }
        return null;
    }

}
