import { requestClient } from '#/api/request';

export interface CountryDashboardMetric {
  countryCode: string;
  countryName: string;
  countryNewUser: number;
  dealerRecharge: number | string;
  gamePayout: number | string;
  gameProfit: number | string;
  gameTotalFlow: number | string;
  giftConsume: number | string;
  luckyGiftAnchorShare: number | string;
  luckyGiftPayout: number | string;
  luckyGiftProfit: number | string;
  luckyGiftTotalFlow: number | string;
  newUserRecharge: number | string;
  officialRecharge: number | string;
  periodKey: string;
  periodName: string;
  salaryExchange: number | string;
  totalRecharge: number | string;
}

export interface CountryDashboardResult {
  computedAt: string;
  endDate?: string;
  periodType: string;
  records: CountryDashboardMetric[];
  startDate?: string;
  total: CountryDashboardMetric;
}

export async function countryDashboard(params: Record<string, any> = {}) {
  return requestClient.get<CountryDashboardResult>('/datav/country-dashboard', {
    params,
  });
}

export async function latestActiveUserCountryCode(params: Record<string, any> = {}) {
  return requestClient.get<Array<Record<string, any>>>(
    '/datav/active/user-country-code',
    {
      params,
    },
  );
}

export async function onlineUserCount(params: Record<string, any> = {}) {
  return requestClient.get<number>('/datav/online/user/count', {
    params,
  });
}

export async function onlineRoomCount(params: Record<string, any> = {}) {
  return requestClient.get<number>('/datav/online/room/count', {
    params,
  });
}
