import { ApiProperty } from '@nestjs/swagger';
import { IsArray, ValidateNested, IsObject } from 'class-validator';
import { Type } from 'class-transformer';
import { DriverDTO } from '../../driver/dtos/DriverDTO';
import { RaceDTO } from '../../race/dtos/RaceDTO';
import { ProtestDTO } from './ProtestDTO';

export class LeagueAdminProtestsDTO {
  @ApiProperty({ type: [ProtestDTO] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => ProtestDTO)
  protests!: ProtestDTO[];

  @ApiProperty({ type: Object })
  @IsObject()
  @ValidateNested()
  @Type(() => RaceDTO)
  racesById!: Record<string, RaceDTO>;

  @ApiProperty({ type: Object })
  @IsObject()
  @ValidateNested()
  @Type(() => DriverDTO)
  driversById!: Record<string, DriverDTO>;
}