import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsDate, IsOptional, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
import { DriverDto } from '../../driver/dto/DriverDto';

export class LeagueJoinRequestDTO {
  @ApiProperty()
  @IsString()
  id: string;

  @ApiProperty()
  @IsString()
  leagueId: string;

  @ApiProperty()
  @IsString()
  driverId: string;

  @ApiProperty()
  @IsDate()
  @Type(() => Date)
  requestedAt: Date;

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

  @ApiProperty({ type: () => DriverDto, required: false })
  @IsOptional()
  @ValidateNested()
  @Type(() => DriverDto)
  driver?: DriverDto; 
}