import {
    RewardQueryParam,
    RewardPageResult,
    RewardSetQueryParam,
    RewardSetPageResult,
    RewardSetParam,
    InitContractWalletParam,
    PokeParam,
    EntrustQueryParam,
    EntrustPageResult,
    EntrustIdParam,
    ContractQueryParam,
    ContractPageResult,
    ForceCloseAllParam,
    IdParam,
    ForceCloseOutParam,
    testValueParam,
} from "@/types/api/swap";
import { Content } from "@/types/api/system/dashboard";
import request from "@/utils/request";
import { AxiosPromise } from "axios";

/**
 * "邀请管理"=>"返佣管理"=>"返佣管理"
 * @param data
 */
export function queryRewardRecordList(
    data: RewardQueryParam
): AxiosPromise<RewardPageResult> {
    return request({
        url: "admin/swap/reward/page-query",
        method: "post",
        params: data,
    });
}

/**
 * "邀请管理"=>"返佣比例"=>"返佣比例列表"
 * @param data
 */
export function queryRewardSetDataList(
    data: RewardSetQueryParam
): AxiosPromise<RewardSetPageResult> {
    return request({
        url: "admin/swap/reward/set/list",
        method: "post",
        params: data,
    });
}

/**
 * "推荐关系图"=>"搜索"
 * @param data
 */
export function memberGetUppers(data: any) {
    return request({
        url: "admin/member/get-uppers",
        method: "post",
        params: data,
    });
}

/**
 * "邀请管理"=>"返佣比例"=>"设置返佣比例"
 * @param data
 */
export function transactionRebateSet(data: RewardSetParam): any {
    return request({
        url: "admin/swap/reward/modify",
        method: "post",
        params: data,
    });
}
/**
 * "邀请管理"=>"返佣比例"=>"设置赛事返佣比例"
 * @param data
 */
export function CompetitionRebate(data: RewardSetParam): any {
    return request({
        url: "admin/swap/reward/modify-wc",
        method: "post",
        params: data,
    });
}

/**
 * "邀请管理"=>"返佣比例"=>"设置跟单返佣比例"
 * @param data
 */
export function rewardModifyFollow(data: RewardSetParam): any {
    return request({
        url: "admin/swap/reward/modify-follow",
        method: "post",
        params: data,
    });
}

/**
 * "邀请管理"=>"返佣比例"=>"设置跟单返佣比例"
 * @param data
 */
export function rewardModifyDividend(data: RewardSetParam): any {
    return request({
        url: "admin/swap/reward/modify-dividend",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"交易对管理"=>"新增交易对"
 */
export function addContractCoin(data: Content): any {
    return request({
        url: "admin/swap-coin/add",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"交易对管理"=>"更新交易对"
 */
export function alterContractCoin(data: Content): any {
    return request({
        url: "admin/swap-coin/alter",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"交易对管理"=>"添加用户合约钱包"
 */
export function initContractWallet(data: InitContractWalletParam): any {
    return request({
        url: "admin/swap-coin/init-wallet",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"交易对管理"=>"戳一下"
 */
export function poke(data: PokeParam): any {
    return request({
        url: "admin/swap-coin/poke",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"交易对管理"=>"获取bias"
 */
export function getBias(data: any): any {
    return request({
        url: "admin/swap-coin/get-bias",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"交易对管理"=>"控盘"
 */
export function setBias(data: any): any {
    return request({
        url: "admin/swap-coin/set-bias",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"委托管理"=>"查询委托"
 */
export function queryEntrustList(
    data: EntrustQueryParam
): AxiosPromise<EntrustPageResult> {
    return request({
        url: "admin/swap/order/page-query",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"委托管理"=>"撤销委托"
 */
export function cancelEntrustOrder(data: EntrustIdParam): any {
    return request({
        url: "admin/swap/order/cancel",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"持仓管理"=>"持仓列表"
 */
export function queryPositionList(
    data: ContractQueryParam
): AxiosPromise<ContractPageResult> {
    return request({
        url: "admin/swap/position-new/page-query",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"持仓管理"=>"所有用户一键平仓"
 */
export function forceCloseAll(data: ForceCloseAllParam): any {
    return request({
        url: "admin/swap/position-new/force-close-all",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"仓位管理"=>"禁止平仓"
 */
export function contractWalletLock(data: IdParam): any {
    return request({
        url: "admin/swap/position-new/lock",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"仓位管理"=>"可以平仓"
 */
export function contractWalletUnLock(data: IdParam): any {
    return request({
        url: "admin/swap/position-new/unlock",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"仓位管理"=>"强平"
 */
export function forceCloseOut(data: ForceCloseOutParam): any {
    return request({
        url: "admin/swap/position-new/force-close-wallet",
        method: "post",
        params: data,
    });
}

/**
 * "永续合约"=>"仓位管理"=>"订单总数"
 */

export function orderQuantity(
    data: ContractQueryParam
): AxiosPromise<ContractPageResult> {
    return request({
        url: "admin/swap/account/page-query",
        method: "post",
        params: data,
    });
}

// 测试价格

export function publishPrice(data: testValueParam): any {
    return request({
        url: "admin/swap/account/publishPrice",
        method: "post",
        params: data,
    });
}

// 代理商学生列表

export function followersAgent(data: any): any {
    return request({
        url: "followadmin/follow/followers-agent",
        method: "post",
        data: data,
    });
}

// 今日新增用户列表

export function todayNewUser(data: any): any {
    return request({
        url: "admin/member/supermember-page-query",
        method: "post",
        params: data,
    });
}

// 代理商学生列表

export function setbackLength(data: any): any {
    return request({
        url: "admin/swap/account/set-back-length",
        method: "post",
        params: data,
    });
}

// 获取K线历史数据

export function getHistory(data: any): any {
    return request({
        url: "https://webcoinapp-api.nihao2029.com/market/exchange/history",
        method: "post",
        params: data,
    });
}

// 获取K线历史数据

export function planList(data: any): any {
    return request({
        url: "https://272m07251r.zicp.fun/robot-match-plan/list",
        method: "post",
        data: data,
    });
}

// 添加k线控制

export function planSave(data: any): any {
    return request({
        url: "https://272m07251r.zicp.fun/robot-match-plan/save",
        method: "post",
        data: data,
    });
}

// 删除k线控制

export function planDelete(data: any): any {
    return request({
        url: "https://272m07251r.zicp.fun/robot-match-plan/delete",
        method: "post",
        data: data,
    });
}

// 获取conf

export function confList(data: any): any {
    return request({
        url: "https://272m07251r.zicp.fun/robot-match-conf/list",
        method: "post",
        data: data,
    });
}

// 设置conf

export function matchConfSave(data: any): any {
    return request({
        url: "https://272m07251r.zicp.fun/robot-match-conf/save",
        method: "post",
        data: data,
    });
}
