import { BaseApiClient } from '../base/BaseApiClient';
import type {
  DriversLeaderboardDto,
  DriverRegistrationStatusDto,
} from '../../dtos';
// Import generated types
import type { DriverDTO, CompleteOnboardingInputDTO, CompleteOnboardingOutputDTO } from '../../types/api-helpers';

/**
 * Drivers API Client
 *
 * Handles all driver-related API operations.
 */
export class DriversApiClient extends BaseApiClient {
  /** Get drivers leaderboard */
  getLeaderboard(): Promise<DriversLeaderboardDto> {
    return this.get<DriversLeaderboardDto>('/drivers/leaderboard');
  }

  /** Complete driver onboarding */
  completeOnboarding(input: CompleteOnboardingInputDTO): Promise<CompleteOnboardingOutputDTO> {
    return this.post<CompleteOnboardingOutputDto>('/drivers/complete-onboarding', input);
  }

  /** Get current driver (based on session) */
  getCurrent(): Promise<DriverDTO | null> {
    return this.get<DriverDto | null>('/drivers/current');
  }

  /** Get driver registration status for a specific race */
  getRegistrationStatus(driverId: string, raceId: string): Promise<DriverRegistrationStatusDto> {
    return this.get<DriverRegistrationStatusDto>(`/drivers/${driverId}/races/${raceId}/registration-status`);
  }
}