import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNotEmpty, IsOptional, IsNumber, IsEnum } from 'class-validator';

export class ApplyPenaltyCommandDTO {
  @ApiProperty()
  @IsString()
  @IsNotEmpty()
  raceId!: string;

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

  @ApiProperty()
  @IsString()
  @IsNotEmpty()
  stewardId!: string;

  @ApiProperty({
    enum: [
      'time_penalty',
      'grid_penalty',
      'points_deduction',
      'disqualification',
      'warning',
      'license_points',
      'probation',
      'fine',
      'race_ban',
    ],
  })
  @IsEnum([
    'time_penalty',
    'grid_penalty',
    'points_deduction',
    'disqualification',
    'warning',
    'license_points',
    'probation',
    'fine',
    'race_ban',
  ])
  type!: string;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsNumber()
  value?: number;

  @ApiProperty()
  @IsString()
  @IsNotEmpty()
  reason!: string;

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

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