import { RacesApiClient } from '../../api/races/RacesApiClient'; import { RaceDetailViewModel } from '../../view-models/RaceDetailViewModel'; // TODO: Move these types to apps/website/lib/types/generated when available type RacesPageDataDto = { races: Array }; type RaceStatsDto = { totalRaces: number }; /** * Race Service * * Orchestrates race operations by coordinating API calls and view model creation. * All dependencies are injected via constructor. */ export class RaceService { constructor( private readonly apiClient: RacesApiClient ) {} /** * Get race detail with view model transformation */ async getRaceDetail( raceId: string, driverId: string ): Promise { const dto = await this.apiClient.getDetail(raceId, driverId); return new RaceDetailViewModel(dto); } /** * Get races page data * TODO: Add view model transformation when view model is available */ async getRacesPageData(): Promise { return this.apiClient.getPageData(); } /** * Get total races statistics * TODO: Add view model transformation when view model is available */ async getRacesTotal(): Promise { return this.apiClient.getTotal(); } }