

import { DateFormatter } from '@/lib/formatters/DateFormatter';
import { RaceResultViewModel } from '@/lib/view-models/RaceResultViewModel';
import { RaceResultCard as UiRaceResultCard } from './RaceResultCard';

interface RaceResultCardProps {
  race: {
    id: string;
    track: string;
    car: string;
    scheduledAt: string;
  };
  result: RaceResultViewModel;
  league?: {
    name: string;
  };
  showLeague?: boolean;
}

export function RaceResultCard({
  race,
  result,
  league,
  showLeague = true,
}: RaceResultCardProps) {
  return (
    <UiRaceResultCard
      raceId={race.id}
      track={race.track}
      car={race.car}
      formattedDate={DateFormatter.formatShort(race.scheduledAt)}
      position={result.position}
      positionLabel={result.formattedPosition}
      startPositionLabel={result.formattedStartPosition}
      incidentsLabel={result.formattedIncidents}
      positionsGainedLabel={result.formattedPositionsGained}
      leagueName={league?.name}
      showLeague={showLeague}
    />
  );
}
