export type AdminJackpotPoolRow = {
  id: number;
  currency_code: string;
  current_amount: number;
  contribution_rate: string;
  trigger_threshold: number;
  payout_rate: string;
  force_trigger_draw_gap: number;
  min_bet_amount: number;
  combo_trigger_play_codes: string[];
  status: number;
  last_trigger_draw_id: number | null;
  updated_at: string | null;
};

export type AdminJackpotPoolsData = {
  items: AdminJackpotPoolRow[];
};

export type AdminJackpotPayoutLogRow = {
  id: number;
  draw_id: number;
  draw_no: string | null;
  jackpot_pool_id: number;
  currency_code: string | null;
  trigger_type: string;
  total_payout_amount: number;
  winner_count: number;
  trigger_snapshot_json: unknown;
  created_at: string | null;
};

export type AdminJackpotPayoutLogsData = {
  items: AdminJackpotPayoutLogRow[];
  meta: {
    current_page: number;
    per_page: number;
    total: number;
    last_page: number;
  };
};

export type AdminJackpotContributionRow = {
  id: number;
  draw_id: number;
  draw_no: string | null;
  jackpot_pool_id: number;
  currency_code: string | null;
  player_id: number;
  site_code: string | null;
  site_player_id: string | null;
  username: string | null;
  nickname: string | null;
  /** @deprecated 使用 username / nickname */
  player_username?: string | null;
  ticket_item_id: number | null;
  ticket_no: string | null;
  contribution_amount: number;
  created_at: string | null;
};

export type AdminJackpotContributionsData = {
  items: AdminJackpotContributionRow[];
  meta: {
    current_page: number;
    per_page: number;
    total: number;
    last_page: number;
  };
};

export type AdminJackpotPoolAdjustmentRow = {
  id: number;
  adjustment_no: string;
  jackpot_pool_id: number;
  admin_user_id: number;
  admin_username: string | null;
  amount_delta: number;
  balance_before: number;
  balance_after: number;
  reason: string;
  created_at: string | null;
};

export type AdminJackpotPoolAdjustmentsData = {
  items: AdminJackpotPoolAdjustmentRow[];
  total: number;
  page: number;
  per_page: number;
};

export type AdminJackpotPoolAdjustResult = {
  adjustment: AdminJackpotPoolAdjustmentRow;
  pool: Pick<AdminJackpotPoolRow, "id" | "currency_code" | "current_amount" | "updated_at">;
};
