export type LeaderboardMetric = 'business' | 'visits';

export interface LeaderboardEntry {
  rank: number;
  user_id: number;
  name: string;
  city_name: string | null;
  booking_count: number;
  business_done: number;
  visit_count: number;
  is_team_lead: boolean;
}

export interface LeaderboardSection {
  role_id: number;
  role_name: string;
  role_label: string;
  limit: number;
  metric: LeaderboardMetric;
  total_booking_count: number;
  total_business_done: number;
  total_visit_count: number;
  rankings: LeaderboardEntry[];
}

export interface LeaderboardPeriod {
  type: 'month' | 'year';
  year: number;
  month: number | null;
  start_date: string;
  end_date: string;
}

export interface LeaderboardRoleOption {
  id: number;
  name: string;
  label: string;
}

export interface LeaderboardMyRank {
  rank: number;
  total_participants: number;
  booking_count: number;
  business_done: number;
  visit_count: number;
}

export interface LeaderboardPageData {
  section: LeaderboardSection;
  available_roles: LeaderboardRoleOption[];
  selected_role_id: number;
  scope: 'city' | 'pan_india';
  city_label: string | null;
  my_rank: LeaderboardMyRank | null;
}

export interface MyTeamMyRank {
  rank: number;
  total_participants: number;
  booking_count: number;
  business_done: number;
  visit_count: number;
}

export interface MyTeamLeaderboard {
  view_type: 'city_head_ranking' | 'city_peers' | 'team_roster';
  title: string;
  scope: 'city' | 'pan_india';
  is_scope_pickable: boolean;
  city_label: string | null;
  role_label: string;
  limit: number;
  metric: LeaderboardMetric;
  total_booking_count: number;
  total_business_done: number;
  total_visit_count: number;
  rankings: LeaderboardEntry[];
  my_rank: MyTeamMyRank | null;
}
