import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsISO8601, IsOptional, IsString } from 'class-validator';

export class CreateLeagueScheduleRaceInputDTO {
  @ApiProperty()
  @IsString()
  track!: string;

  @ApiProperty()
  @IsString()
  car!: string;

  @ApiProperty({
    description: 'ISO-8601 timestamp string (UTC recommended).',
    example: '2025-01-01T12:00:00.000Z',
  })
  @IsISO8601()
  scheduledAtIso!: string;
}

export class UpdateLeagueScheduleRaceInputDTO {
  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  track?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  car?: string;

  @ApiPropertyOptional({
    description: 'ISO-8601 timestamp string (UTC recommended).',
    example: '2025-01-01T12:00:00.000Z',
  })
  @IsOptional()
  @IsISO8601()
  scheduledAtIso?: string;
}

export class CreateLeagueScheduleRaceOutputDTO {
  @ApiProperty()
  @IsString()
  raceId!: string;
}

export class LeagueScheduleRaceMutationSuccessDTO {
  @ApiProperty()
  @IsBoolean()
  success!: boolean;
}