import { BaseApiClient } from '../base/BaseApiClient'; import type { RaceStatsDto, RacesPageDataDto, RaceDetailDto, RaceResultsDetailDto, RaceWithSOFDto, RegisterForRaceInputDto, ImportRaceResultsInputDto, ImportRaceResultsSummaryDto, WithdrawFromRaceInputDto, } from '../../dtos'; /** * Races API Client * * Handles all race-related API operations. */ export class RacesApiClient extends BaseApiClient { /** Get total number of races */ getTotal(): Promise { return this.get('/races/total-races'); } /** Get races page data */ getPageData(): Promise { return this.get('/races/page-data'); } /** Get race detail */ getDetail(raceId: string, driverId: string): Promise { return this.get(`/races/${raceId}?driverId=${driverId}`); } /** Get race results detail */ getResultsDetail(raceId: string): Promise { return this.get(`/races/${raceId}/results`); } /** Get race with strength of field */ getWithSOF(raceId: string): Promise { return this.get(`/races/${raceId}/sof`); } /** Register for race */ register(raceId: string, input: RegisterForRaceInputDto): Promise { return this.post(`/races/${raceId}/register`, input); } /** Import race results */ importResults(raceId: string, input: ImportRaceResultsInputDto): Promise { return this.post(`/races/${raceId}/import-results`, input); } /** Withdraw from race */ withdraw(raceId: string, input: WithdrawFromRaceInputDto): Promise { return this.post(`/races/${raceId}/withdraw`, input); } /** Cancel race */ cancel(raceId: string): Promise { return this.post(`/races/${raceId}/cancel`, {}); } /** Complete race */ complete(raceId: string): Promise { return this.post(`/races/${raceId}/complete`, {}); } }