/**
 * Application Port: IRaceRepository
 * 
 * Repository interface for Race entity CRUD operations.
 * Defines async methods using domain entities as types.
 */

import type { Race, RaceStatus } from '../entities/Race';

export interface IRaceRepository {
  /**
   * Find a race by ID
   */
  findById(id: string): Promise<Race | null>;

  /**
   * Find all races
   */
  findAll(): Promise<Race[]>;

  /**
   * Find races by league ID
   */
  findByLeagueId(leagueId: string): Promise<Race[]>;

  /**
   * Find upcoming races for a league
   */
  findUpcomingByLeagueId(leagueId: string): Promise<Race[]>;

  /**
   * Find completed races for a league
   */
  findCompletedByLeagueId(leagueId: string): Promise<Race[]>;

  /**
   * Find races by status
   */
  findByStatus(status: RaceStatus): Promise<Race[]>;

  /**
   * Find races scheduled within a date range
   */
  findByDateRange(startDate: Date, endDate: Date): Promise<Race[]>;

  /**
   * Create a new race
   */
  create(race: Race): Promise<Race>;

  /**
   * Update an existing race
   */
  update(race: Race): Promise<Race>;

  /**
   * Delete a race by ID
   */
  delete(id: string): Promise<void>;

  /**
   * Check if a race exists by ID
   */
  exists(id: string): Promise<boolean>;
}