import type { SessionType, RaceStatus } from '../../domain/entities/Race';
import type { Presenter } from '@core/shared/presentation';

export interface RaceDetailEntryViewModel {
  id: string;
  name: string;
  country: string;
  avatarUrl: string;
  rating: number | null;
  isCurrentUser: boolean;
}

export interface RaceDetailUserResultViewModel {
  position: number;
  startPosition: number;
  incidents: number;
  fastestLap: number;
  positionChange: number;
  isPodium: boolean;
  isClean: boolean;
  ratingChange: number | null;
}

export interface RaceDetailRaceViewModel {
  id: string;
  leagueId: string;
  track: string;
  car: string;
  scheduledAt: string;
  sessionType: SessionType;
  status: RaceStatus;
  strengthOfField: number | null;
  registeredCount?: number;
  maxParticipants?: number;
}

export interface RaceDetailLeagueViewModel {
  id: string;
  name: string;
  description: string;
  settings: {
    maxDrivers?: number;
    qualifyingFormat?: string;
  };
}

export interface RaceDetailViewModel {
  race: RaceDetailRaceViewModel | null;
  league: RaceDetailLeagueViewModel | null;
  entryList: RaceDetailEntryViewModel[];
  registration: {
    isUserRegistered: boolean;
    canRegister: boolean;
  };
  userResult: RaceDetailUserResultViewModel | null;
  error?: string;
}

export interface IRaceDetailPresenter
  extends Presenter<RaceDetailViewModel, RaceDetailViewModel> {}