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

export interface DriverInfo {
  id: string;
  name: string;
}

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({
    required: false,
    type: () => Object,
  })
  @IsOptional()
  driver?: DriverInfo;
}