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

export class WizardErrorsBasicsDTO {
  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  name?: string;

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

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

export class WizardErrorsStructureDTO {
  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  maxDrivers?: string;

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

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

export class WizardErrorsTimingsDTO {
  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  qualifyingMinutes?: string;

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

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

export class WizardErrorsScoringDTO {
  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  patternId?: string;
}

export class WizardErrorsDTO {
  @ApiProperty({ type: WizardErrorsBasicsDTO, required: false })
  @IsOptional()
  @ValidateNested()
  @Type(() => WizardErrorsBasicsDTO)
  basics?: WizardErrorsBasicsDTO;

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

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

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

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