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

/**
 * ProtestDTO represents a protest that is filed against a specific race
 * but is queried and managed in a league context.
 *
 * Both `leagueId` and `raceId` are exposed so that API consumers can
 * clearly relate the protest back to the league admin view while still
 * understanding which concrete race it belongs to.
 */
export class ProtestDTO {
  @ApiProperty()
  @IsString()
  id!: string;

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

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

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

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

  @ApiProperty()
  @IsDate()
  @Type(() => Date)
  submittedAt!: Date;

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

  @ApiProperty({ enum: ['pending', 'accepted', 'rejected'] })
  @IsEnum(['pending', 'accepted', 'rejected'])
  status!: 'pending' | 'accepted' | 'rejected';
}