import { request } from 'umi';
import { api } from '../api';
let wapi = api + '/gameData'

/**
 * 分页信息
 * @param pageNum 页码
 * @param pageSize 每页数量
 */
export interface Paging {
    pageNum: number,
    pageSize: number,
    sourceSystem?: string
}


export interface SortProps {
    sortFiled?: string, // 排序字段
    sortType?: string,  // 排序方式：升序asc;降序desc
    sortAsc?: boolean   // 排序类型：升序 true;降序 false
}

/**
 * 游戏充值排行榜
 * @param beginDay 开始日期
 * @param endDay 结束日期
 * @param companyId 公司ID
 * @param sysUserId 投手ID
 */
export interface GameRechargeListType extends Paging, SortProps {
    beginDay?: string,  // 充值开始日期
    endDay?: string,    // 充值结束日期
    companyId?: number, // 公司ID
    sysUserId?: number  // 投手ID
}
export async function getRechargeGameListApi(data: GameRechargeListType) {
    return request(wapi + `/ranking/game`, {
        method: 'POST',
        data
    });
}

/**
 * 玩家充值排行榜
 * @param beginDay 开始日期
 * @param endDay 结束日期
 * @param companyId 公司ID
 * @param sysUserId 投手ID
 */
export interface UserRechargeListType extends Paging {
    beginDay?: string,  // 开始日期
    endDay?: string,    // 结束日期
    companyId?: number, // 公司ID
    sysUserId?: number  // 投手ID
    latestAmountUntilNowTimeMin?: number
    latestAmountUntilNowTimeMax?: number
}
export async function getRechargeUserListApi(data: UserRechargeListType) {
    return request(wapi + `/ranking/player`, {
        method: 'POST',
        data
    });
}

export interface ChannelProps extends Paging, SortProps {
    agentId?: number,
    beginDay?: string,
    endDay?: string,
    pitcherId?: number
    type?: string
}
/**
 * 推广渠道充值排行帮
 * @param data 
 * @returns 
 */
export async function getAgentRechargeRankingListApi(data: ChannelProps) {
    return request(wapi + `/ranking/agent`, {
        method: 'POST',
        data
    });
}

export interface AccountProps extends Paging, SortProps {
    accountId?: number
    beginDay?: string,
    endDay?: string,
    gameId?: number,
    pitcherId?: number,
    type?: string
}
/**
 * 推广账号充值排行榜
 * @param data 
 * @returns 
 */
export async function getAccountRechargeRankingListApi(data: AccountProps) {
    return request(wapi + `/ranking/account`, {
        method: 'POST',
        data
    });
}