import type { AdminReportDailyProfitRow } from "@/types/api/admin-reports";

export type DashboardAnalyticsPeriod =
  | "today"
  | "last_7_days"
  | "last_30_days"
  | "this_month"
  | "lifetime"
  | "custom";

export type DashboardAnalyticsMetric = "overview" | "bet" | "payout" | "profit";

export type AdminDashboardAnalyticsSummary = {
  total_bet_minor: number;
  total_payout_minor: number;
  approx_house_gross_minor: number;
  draw_count: number;
  business_day_count: number;
};

export type AdminDashboardAnalyticsPlayRow = {
  play_code: string;
  dimension: number;
  total_bet_minor: number;
  total_payout_minor: number;
  approx_house_gross_minor: number;
};

export type AdminDashboardAnalyticsChartMeta = {
  chart_date_from: string;
  chart_date_to: string;
  truncated: boolean;
  span_days: number;
};

/** `GET /api/v1/admin/dashboard/analytics` */
export type AdminDashboardAnalyticsData = {
  period: DashboardAnalyticsPeriod;
  metric: DashboardAnalyticsMetric;
  play_code: string | null;
  date_from: string;
  date_to: string;
  currency_code: string | null;
  summary: AdminDashboardAnalyticsSummary;
  daily_series: AdminReportDailyProfitRow[];
  chart_meta: AdminDashboardAnalyticsChartMeta;
  play_breakdown: AdminDashboardAnalyticsPlayRow[];
};

export type AdminDashboardAnalyticsQuery = {
  period?: DashboardAnalyticsPeriod;
  date_from?: string;
  date_to?: string;
  metric?: DashboardAnalyticsMetric;
  play_code?: string;
};
