import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsArray, IsNumber, IsString, ValidateNested } from 'class-validator';
import { DriverDTO } from '../../driver/dtos/DriverDTO';

export class LeagueStandingDTO {
  @ApiProperty()
  @IsString()
  driverId!: string;

  @ApiProperty({ type: () => DriverDTO })
  @ValidateNested()
  @Type(() => DriverDTO)
  driver!: DriverDTO;

  @ApiProperty()
  @IsNumber()
  points!: number;

  @ApiProperty()
  @IsNumber()
  position!: number;

  @ApiProperty()
  @IsNumber()
  wins!: number;

  @ApiProperty()
  @IsNumber()
  podiums!: number;

  @ApiProperty()
  @IsNumber()
  races!: number;

  @ApiProperty()
  @IsNumber()
  positionChange!: number;

  @ApiProperty()
  @IsNumber()
  lastRacePoints!: number;

  @ApiProperty()
  @IsArray()
  @IsString({ each: true })
  droppedRaceIds!: string[];
}