import createAxios from '/@/utils/axios'

export const url = '/admin/Dashboard/'

export interface DashboardTrend {
    days: string[]
    new_users: number[]
    deposit_amount: string[]
    bet_amount: string[]
}

export interface DashboardChannelShareItem {
    name: string
    value: number
}

/** 成功充值金额按渠道（value 为两位小数字符串） */
export interface DashboardDepositAmountChannelItem {
    name: string
    value: string
}

export interface DashboardRecentUser {
    id: number
    username: string
    create_time: number
    channel_name: string
    head_image: string
}

export interface DashboardStats {
    user_total: number
    user_new_today: number
    user_new_yesterday: number
    user_new_growth_pct: number | null
    deposit_today_amount: string
    deposit_today_count: number
    withdraw_pending: number
    bet_today_amount: string
    bet_today_count: number
}

export interface DashboardPayload {
    remark: string
    stats: DashboardStats
    trend: DashboardTrend
    channel_share: DashboardChannelShareItem[]
    deposit_amount_channel_share: DashboardDepositAmountChannelItem[]
    recent_users: DashboardRecentUser[]
}

export function index() {
    return createAxios({
        url: url + 'index',
        method: 'get',
    })
}
