

import { RaceResultViewModel } from '@/lib/view-models/RaceResultViewModel';
import { RaceResultCard as UiRaceResultCard } from './RaceResultCard';
import { DateDisplay } from '@/lib/display-objects/DateDisplay';

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={DateDisplay.formatShort(race.scheduledAt)}
      position={result.position}
      positionLabel={result.formattedPosition}
      startPositionLabel={result.formattedStartPosition}
      incidentsLabel={result.formattedIncidents}
      positionsGainedLabel={result.formattedPositionsGained}
      leagueName={league?.name}
      showLeague={showLeague}
    />
  );
}
