import type { Presenter } from '@core/shared/presentation';

export interface LeagueDriverSeasonStatsItemViewModel {
  leagueId: string;
  driverId: string;
  position: number;
  driverName: string;
  teamId?: string;
  teamName?: string;
  totalPoints: number;
  basePoints: number;
  penaltyPoints: number;
  bonusPoints: number;
  pointsPerRace: number;
  racesStarted: number;
  racesFinished: number;
  dnfs: number;
  noShows: number;
  avgFinish: number | null;
  rating: number | null;
  ratingChange: number | null;
}

export interface LeagueDriverSeasonStatsViewModel {
  leagueId: string;
  stats: LeagueDriverSeasonStatsItemViewModel[];
}

export interface LeagueDriverSeasonStatsResultDTO {
  leagueId: string;
  standings: Array<{
    driverId: string;
    position: number;
    points: number;
    racesCompleted: number;
  }>;
  penalties: Map<string, { baseDelta: number; bonusDelta: number }>;
  driverResults: Map<string, Array<{ position: number }>>;
  driverRatings: Map<string, { rating: number | null; ratingChange: number | null }>;
}

export interface ILeagueDriverSeasonStatsPresenter
  extends Presenter<LeagueDriverSeasonStatsResultDTO, LeagueDriverSeasonStatsViewModel> {}