import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString } from 'class-validator';
import { RaceDetailEntryDTO } from './RaceDetailEntryDTO';
import { RaceDetailLeagueDTO } from './RaceDetailLeagueDTO';
import { RaceDetailRaceDTO } from './RaceDetailRaceDTO';
import { RaceDetailRegistrationDTO } from './RaceDetailRegistrationDTO';
import { RaceDetailUserResultDTO } from './RaceDetailUserResultDTO';

export class RaceDetailDTO {
  @ApiProperty({ nullable: true })
  race!: RaceDetailRaceDTO | null;

  @ApiProperty({ nullable: true })
  league!: RaceDetailLeagueDTO | null;

  @ApiProperty({ type: [RaceDetailEntryDTO] })
  entryList!: RaceDetailEntryDTO[];

  @ApiProperty()
  registration!: RaceDetailRegistrationDTO;

  @ApiProperty({ nullable: true })
  userResult!: RaceDetailUserResultDTO | null;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  error?: string;
}