import { RaceDetailEntryDTO } from '@/lib/types/generated/RaceDetailEntryDTO';

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

  constructor(dto: RaceDetailEntryDTO, currentDriverId: string, rating?: number) {
    this.id = dto.id;
    this.name = dto.name;
    this.country = dto.country;
    this.avatarUrl = dto.avatarUrl || '';
    this.isCurrentUser = dto.id === currentDriverId;
    this.rating = rating ?? null;
  }
}