/**
 * Application Port: DriverStatsRepository
 * 
 * Repository interface for storing and retrieving computed driver statistics.
 * This is used for caching computed stats and serving frontend data.
 */

export interface DriverStats {
  rating: number;
  safetyRating: number;
  sportsmanshipRating: number;
  totalRaces: number;
  wins: number;
  podiums: number;
  dnfs: number;
  avgFinish: number;
  bestFinish: number;
  worstFinish: number;
  consistency: number;
  experienceLevel: string;
  overallRank: number | null;
}

export interface DriverStatsRepository {
  /**
   * Get stats for a specific driver
   */
  getDriverStats(driverId: string): Promise<DriverStats | null>;

  /**
   * Get stats for a specific driver (synchronous)
   */
  getDriverStatsSync(driverId: string): DriverStats | null;

  /**
   * Save stats for a specific driver
   */
  saveDriverStats(driverId: string, stats: DriverStats): Promise<void>;

  /**
   * Get all driver stats
   */
  getAllStats(): Promise<Map<string, DriverStats>>;

  /**
   * Clear all stats
   */
  clear(): Promise<void>;
}