import { request } from 'umi';
import { api } from '../api';
import { Paging, SortProps } from './rankingList';
import { ActiveEnum, TableEnum } from '@/components/QueryForm/const';
let wapi = api + '/gameData'

export interface GameWaterProps extends Paging, SortProps {
    gameClassify?: string,
    gameName?: string,
    rechargeDate?: string
}
/**
 * 每日流水贡献
 * @param data 
 * @returns 
 */
export async function getGameWaterListApi(data: GameWaterProps) {
    return request(wapi + `/gameData/water`, {
        method: 'POST',
        data
    });
}

export interface GameTotalProps extends Paging, SortProps {
    gameClassify?: string,
    gameName?: string,
    // 充值开始时间
    rechargeBeginDate?: string
    rechargeEndDate?: string
    // 注册开始时间
    registeredBeginDate?: string
    registeredEndDate?: string
    tableTypes?: string
}
/**
 * 游戏总数据
 * @param data 
 * @returns 
 */
export async function getGameTotalListApi(data: GameTotalProps) {
    return request(wapi + `/gameData/total`, {
        method: 'POST',
        data
    });
}
/**
 * 游戏总数据总计
 * @param data 
 * @returns 
 */
export async function getGameTotalTotalApi(data: GameTotalProps) {
    return request(wapi + `/gameData/total/sum`, {
        method: 'POST',
        data
    });
}

export type GameDayProps = Omit<GameTotalProps, 'rechargeBeginDate' | 'rechargeEndDate'>
/**
 * 游戏每日数据
 * @param data 
 * @returns 
 */
export async function getGameDayListApi(data: GameDayProps) {
    return request(wapi + `/gameData/day`, {
        method: 'POST',
        data
    });
}
/**
 * 游戏每日数据总计
 * @param data 
 * @returns 
 */
export async function getGameDayTotalApi(data: GameDayProps) {
    return request(wapi + `/gameData/day/total`, {
        method: 'POST',
        data
    });
}

export interface GameH5Props extends Paging, SortProps {
    // 注册开始时间
    costBeginDate?: string,
    costEndDate?: string,
    gameName?: string,
    // 充值开始时间
    rechargeBeginDate?: string,
    rechargeEndDate?: string
}

export async function getGameH5ListApi(data: GameH5Props) {
    return request(wapi + `/gameData/h5`, {
        method: 'POST',
        data
    });
}


export interface GameAgainProps {
    gameId: number,
    gameName: string,
    beginDate?: string,
    endDate?: string,
    sourceSystem?: string
}
/**
 * 推广渠道每日复充数据q
 * @param data 
 * @returns 
 */
export async function getGameDataAgainListApi(data: GameAgainProps) {
    return request(wapi + `/gameData/again`, {
        method: 'POST',
        data
    });
}


export interface LtvListProps extends Paging, SortProps {
    tableTypes: string,   // buy nature total
    classify?: number,
    gameId?: number,
    registeredBeginDate?: string,
    registeredEndDate?: string
}
/**
 * LTV数据
 * @param data 
 * @returns 
 */
export async function gteLtvListApi(data: LtvListProps) {
    return request(wapi + `/gameData/ltv`, {
        method: 'POST',
        data
    });
}
/**
 * LTV总计栏
 * @param data 
 * @returns 
 */
export async function gteLtvTotalApi(data: LtvListProps) {
    return request(wapi + `/gameData/ltv/total`, {
        method: 'POST',
        data
    });
}


export interface AgainListProps extends LtvListProps {}
/**
 * 游戏首日复充
 * @param data 
 * @returns 
 */
export async function getAgainListApi(data: AgainListProps) {
    return request(wapi + `/gameData/firstNewUser/again`, {
        method: 'POST',
        data
    });
}

/**
 * 游戏首日复充 总计
 * @param data 
 * @returns 
 */
export async function getAgainTotalApi(data: AgainListProps) {
    return request(wapi + `/gameData/firstNewUser/again/total`, {
        method: 'POST',
        data
    });
}


/**
 * 用户详情
 * @param data 
 * @returns 
 */
export async function getDetailsApi(data: AgainListProps) {
    return request(wapi + `/gameData/user/details`, {
        method: 'POST',
        data
    });
}

export interface ActiveDataProps extends Paging, SortProps {
    tableTypes?: TableEnum,
    activeTypes: ActiveEnum,
    classify?: number,
    gameId?: number,
    // 注册开始时间
    registeredBeginDate?: string,
    registeredEndDate?: string,
}
/**
 * 留存数据
 * @param data 
 * @returns 
 */
export async function getActiveDataListApi(data: ActiveDataProps) {
    return request(wapi + `/gameData/activeData/day`, {
        method: 'POST',
        data
    });
}

/**
 * 留存总计
 * @param data 
 * @returns 
 */
export async function getActiveDataTotalApi(data: ActiveDataProps) {
    return request(wapi + `/gameData/activeData/total`, {
        method: 'POST',
        data
    });
}


/**
 * 月留存数据
 * @param data 
 * @returns 
 */
export async function getActiveDataMonthListApi(data: ActiveDataProps) {
    return request(wapi + `/gameData/activeData/month`, {
        method: 'POST',
        data
    });
}

/**
 * 月留存总计
 * @param data 
 * @returns 
 */
export async function getActiveDataMonthTotalApi(data: ActiveDataProps) {
    return request(wapi + `/gameData/activeData/monthTotal`, {
        method: 'POST',
        data
    });
}