import { post, get } from "@/utils/request";

enum Route {
    //获取消息url
    getMsgServer = '/getMsgServer',
    // 平台配置
    getPlatformConfig = '/getPlatformConfig',
    // 支付方式
    getPayMethodList = '/getPayMethodList',
    getPayClass = '/getPayClass',
    // 获取充值金额配置
    depositList = '/getShop2List',
    // 用户提交充值
    userDeposit = '/buyShop2',
    // 获取充值记录
    getPayRecords = '/getPayRecords',
    // 钻石兑换金币
    convert = '/diamondConvert',
    // 金币流水
    getFlowRecord = '/getFlowRecordPage',
    getAllGroup = '/allGroup',
    // 超值礼包三选一
    getOneOfThree = '/getOneOfThree',
    // 购买三选一礼包
    buyOneOfThree = '/buyOneOfThree',
    // 超值礼包领取
    receiveOneOfThree = '/receiveOneOfThree',
    // 获取可用提现方式
    getWithdrawMethod = '/getWithdrawMethod',
    // 提现
    userWithdraw = '/withdraw',
    // 提现记录
    getWithDrawRecord = '/getWithDrawRecordPage',
    // 个人下注返利
    getTotalRebate = '/getTotalRebate',
    // 领取个人下注返利
    receiveTotalRebate = '/receiveTotalRebate',
    // 校准金币数量
    getCoinsNum = '/getCoinsNum',
    // vip 日周月领奖
    getVipAwardCycle = '/receiveVipAward',
    // 获取vip配置详情
    getVipAward = '/getVipAward',
    // vip等级领奖
    getVipLvAward = '/receiveVipAwardLevel',
    // 无限代理
    getChildRebate = '/getChildRebate',
    // 无限代理 领取奖金
    receiveChildRebate = '/receiveChildRebate',
    // 获取数据
    getChildRebateInfo = '/getChildRebateInfo',
    getChildRebateRecordsDetail = "/getChildRebateRecordsDetailPage",
    getChildRebateRecords = "/getChildRebateRecordsPage",
    // 无限代理 返利列表
    getChildRebateDetail = '/getChildRebateDetailPage',
    // 活动任务
    getCustomClassList = '/getCustomClassList',
    // 活动任务 列表查询
    getTaskList = '/getTaskList',
    // 获取道具
    updatePropsCache = '/updatePropsCache',
    // 获取转盘数据
    getTurntable = '/getTurntable2',
    // 获取转盘结果
    getTurntableResult = '/getTurntable2Result',
    // 活动 领取提交
    getTaskAward = '/receiveTaskAward',
    // 助力转盘任务领奖
    receiveTurntable = '/receiveTurntable2',
    // 邮件 
    getMail = '/getMail',
    readMail = '/readMail',
    receiveMailAttachments = '/receiveMailAttachments',
    checkNewMail = '/checkNewMail',
    // 银行账户管理
    getWithDrawAccount = '/getWithDrawAccount',
    // 推广电话
    getPopularizePhones = '/getPopularizePhones',
    // 转盘日志
    getTurntable2Task = '/getTurntable2Task',
    // 游戏跳转路径
    getGameUrl = '/getGameUrl',
    // 绑定上级
    acceptInvite = '/acceptInvite',
    // 自己使用兑换码
    giftCode = '/useGiftCode',
    // 周返现
    getCycleRebate = '/getCycleRebate',
    // 周返现 领取
    receiveCycleRebateLoss = '/receiveCycleRebateLoss',
    // 游戏日志
    getCoinsDetailLog = '/getCoinsDetailLogPage',
    // 获取道具信息
    getPropsCache = '/updatePropsCache',
    // 获取签到数据
    getCheckin = '/getCheckin',

    getEverydayRebate =  '/getEverydayRebate',

    receiveEverydayRebateBet = '/receiveEverydayRebateBet',
    // 拼单单获取活动数据
    getPddTask = '/getPddTask',
    // 拼单单提升中奖几率
    addPddOdds = '/addPddOdds',
    // 拼单单购买积分
    buyPddScore = '/buyPddScore',
    // 拼单单中奖记录
    pddAwardRecords = '/getPddRecordsList',
    // 获取签到数据
    getChecki = '/getCheckin',
    // 签到同时领取周奖励
    checkinDay = '/checkinDay',
    // 获取公告列表 
    getNotice = '/getNotice',
    // 读取公告 
    readNotice = '/readNotice',
    // 检查新公告 
    checkNewNotice = '/checkNewNotice',
}

class Api {
    request = post;
    notify = post;
    /**
     * 支付方式
     * @returns api
     */
    getPayMethodList = () => {
        return this.request(Route.getPayMethodList);
    };
    /**
     * 支付方式2
     * @returns api
     */
    getPayClass = () => {
        return this.request(Route.getPayClass);
    };
    /**
     * 充值商品列表
     * @returns api
     */
    depositList = () => {
        return this.request(Route.depositList);
    };
    /**
     * 用户充值动作
     * @param {String} _id 商品_id字符串
     * @param {Number} method 支付方式
     * @returns api
     */
    userDeposit = (data: any) => {
        return this.request(Route.userDeposit, data);
    };
    /**
     * 充值记录
     * @param {Number} pageIndex 页码
     * @param {Number} pageSize 每页记录数
     * @returns api
     */
    getPayRecords = (data: any) => {
        return this.request(Route.getPayRecords, data);
    };
    /**
     * 钻石兑换金币
     * @returns api
     */
    convert = () => {
        return this.request(Route.convert);
    };
    /**
     * 金币流水
     * @param {Number} pageIndex 页码
     * @param {Number} pageSize 每页记录数
     * @returns api
     */
    getFlowRecord = (data: any) => {
        return this.request(Route.getFlowRecord, data);
    };
    getAllGroup = (data: any) => {
        return this.request(Route.getAllGroup, data);
    };
    /**
     * 超值礼包三选一
     * @returns api
     */
    getOneOfThree = () => {
        return this.request(Route.getOneOfThree);
    };
    /**
     * 购买礼包三选一
     * @param {String} _id 商品_id
     * @param {Number} method 支付方式
     * @param {*} data
     * @returns api
     */
    buyOneOfThree = (data: any) => {
        return this.request(Route.buyOneOfThree, data);
    };
    /**礼包领取 */
    receiveOneOfThree = () => {
        return this.request(Route.receiveOneOfThree);
    };
    /**
     * 获取提现渠道
     * @returns api
     */
    getWithdrawMethod = () => {
        return this.request(Route.getWithdrawMethod);
    };
    /**
     * 用户提现
     * @param {Number} amount 提现金额
     * @param {String} method 提现方式
     * @param {String} account 提现账户
     * @param {String} holder 持有者
     * @returns api
     */
    userWithdraw = (data: any) => {
        return this.request(Route.userWithdraw, data);
    };
    /**
     * 提现日志
     * @param {Number} pageIndex 页码
     * @param {Number} pageSize 每页记录数
     * @returns
     */
    getWithDrawRecord = (data: any) => {
        return this.request(Route.getWithDrawRecord, data);
    };
    /**
     * 个人下注返利
     * @returns
     */
    getTotalRebate = () => {
        return this.request(Route.getTotalRebate);
    };
    /**
     * 领取个人下注返利
     * @returns
     */
    receiveTotalRebate = () => {
        return this.request(Route.receiveTotalRebate);
    };
    /**
     * 校准金币
     */
    getCoinsNum = () => {
        return this.request(Route.getCoinsNum);
    };
    /**
     * vip 日周月领奖
     * @param {number} awardType 领奖类型 0每日奖励 1每周奖励 2每月奖励
     * @returns
     */
    getVipAwardCycle = (awardType: any) => {
        return this.request(Route.getVipAwardCycle, { awardType });
    };
    /**
     * 获取vip配置详情
     * @returns
     */
    getVipAward = () => {
        return this.request(Route.getVipAward);
    };
    /**
     * vip等级领取
     * @param {String} _id vi配置_id字段
     * @returns
     */
    getVipLvAward = (_id: any) => {
        return this.request(Route.getVipLvAward, { _id });
    };
    /**
     * 无限代理
     * @returns
     */
    getChildRebate = () => {
        return this.request(Route.getChildRebate);
    };
    /**
     * 无限代理 领取奖金
     * @returns
     */
    receiveChildRebate = (data: any) => {
        return this.request(Route.receiveChildRebate, data);
    };
    getChildRebateInfo = (data: any) => {
        return this.request(Route.getChildRebateInfo, data);
    }
    getChildRebateRecordsDetail = (data: any) => {
        return this.request(Route.getChildRebateRecordsDetail, data);
    }
    getChildRebateRecords = (data: any) => {
        return this.request(Route.getChildRebateRecords, data);
    }
    /**
     * 无限代理 返利列表
     * @returns
     */
    getChildRebateDetail = (data: any) => {
        return this.request(Route.getChildRebateDetail, data);
    };
    /**
     * 活动任务
     * @returns
     */
    getCustomClassList = () => {
        return this.request(Route.getCustomClassList);
    };
    /**
     * 活动任务 列表查询
     * @returns
     */
    getTaskList = (data: any) => {
        return this.request(Route.getTaskList, data);
    };
    /**
     * 获取 道具
     * @returns
     * @param {String} propId vi配置_id字段
     */
    updatePropsCache = (data: any) => {
        return this.request(Route.updatePropsCache, data);
    };
    /**
     * 获取转盘数据
     * @param {Number} recordSize
     * @returns
     */
    getTurntable = (data: any) => {
        return this.request(Route.getTurntable, data)
    }
    /**
     *获取转盘结果
     * @returns
     */
    getTurntableResult = () => {
        return this.request(Route.getTurntableResult)
    }
    /**
     *获取转盘结果
     * @returns
     */
    getTaskAward = (data: any) => {
        return this.request(Route.getTaskAward, data)
    }
    /**
     * 转盘领奖
     * @returns
     */
    receiveTurntable = (_id: any) => {
        return this.request(Route.receiveTurntable, { _id })
    }
    /**
     * 邮件
     * @returns
     */
    getMail = (data: any) => {
        return this.request(Route.getMail, data)
    }
    readMail = (_id: any) => {
        return this.request(Route.readMail, { _id })
    }
    receiveMailAttachments = (_id: any) => {
        return this.request(Route.receiveMailAttachments, { _id })
    }
    checkNewMail = () => {
        return this.request(Route.checkNewMail)
    }
    /**
     * 银行账户管理
     * @returns
     */
    getWithDrawAccount = () => {
        return this.request(Route.getWithDrawAccount)
    }
    /**
     * 推广电话
     * @returns
     */
    getPopularizePhones = () => {
        return this.request(Route.getPopularizePhones)
    }
    /**
     *
     * @param {*} data
     * @returns
     */
    getTurntable2Task = (data: any) => {
        return this.request(Route.getTurntable2Task, data)
    }
    /**
     * 获取游戏跳转路径
     * @returns
     */
    getGameUrl = (data: any) => {
        let isMobile
        if (/(Mobile|iPhone|iPod|iOS|Android)/i.test(navigator.userAgent)) {
            isMobile = true
        } else {
            isMobile = false
        }
        const p = { ...data, isMobile, }
        return this.request(Route.getGameUrl, p)
    }

    /**
     * 通知绑定上级id
     * @param {Number} inviteUid
     * @returns
     */
    acceptInvite = (inviteUid: any) => {
        return this.notify(Route.acceptInvite, { inviteUid })
    }

    /**
     * 兑换码  兑换
     * @param {code} code
     * @returns
     */
    giftCode = (code: any) => {
        return this.request(Route.giftCode, { code })
    }
    /**
     * 周返现 获取
     */
    getCycleRebate = () => {
        return this.request(Route.getCycleRebate)
    }

    getEverydayRebate = () => {
        return this.request(Route.getEverydayRebate)
    }

    receiveEverydayRebateBet = () => {
        return this.request(Route.receiveEverydayRebateBet)
    }

    receiveCycleRebateLoss = () => {
        return this.request(Route.receiveCycleRebateLoss)
    }
    /**
     * 游戏金额流水
     * @param {Number} pageIndex 页码
     * @param {Number} pageSize 每页记录数
     * @returns api
     */
    getCoinsDetailLog = (data:any) => {
        return this.request(Route.getCoinsDetailLog, data);
    };
    /**
     * 游戏金额流水
     * @param {id} id 道具ID
     * @returns api
     */
    getPropsCache = (data:any) => {
        return this.request(Route.getPropsCache, data);
    };
    /**
     * 拼单单获取活动数据
     * @returns api
     */
    getPddTask = () => {
        return this.request(Route.getPddTask);
    };

    addPddOdds = (data:any) => {
        return this.request(Route.addPddOdds, data);
    };

    pddAwardRecords = (data:any) => {
        return this.request(Route.pddAwardRecords,data);
    };

    buyPddScore = (data:any) => {
        return this.request(Route.buyPddScore,data);
    };
    getCheckin = (data:any) => {
        return this.request(Route.getCheckin,data);
    };
    checkinDay = (data:any) => {
        return this.request(Route.checkinDay,data);
    };
    getNotice = (data:any) => {
        return this.request(Route.getNotice,data);
    };
    readNotice = (data:any) => {
        return this.request(Route.readNotice,data);
    };
    checkNewNotice = (data:any) => {
        return this.request(Route.checkNewNotice,data);
    };
}

export default new Api();

