import { usePageDataMultiple } from '@/lib/page/usePageData';
import { useInject } from '@/lib/di/hooks/useInject';
import { RACE_RESULTS_SERVICE_TOKEN } from '@/lib/di/tokens';

export function useRaceResultsPageData(raceId: string, currentDriverId: string) {
  const raceResultsService = useInject(RACE_RESULTS_SERVICE_TOKEN);

  return usePageDataMultiple({
    results: {
      queryKey: ['raceResultsDetail', raceId, currentDriverId],
      queryFn: () => raceResultsService.getResultsDetail(raceId, currentDriverId),
      enabled: !!raceId,
    },
    sof: {
      queryKey: ['raceWithSOF', raceId],
      queryFn: () => raceResultsService.getWithSOF(raceId),
      enabled: !!raceId,
    },
  });
}