import { ApiProperty } from '@nestjs/swagger';

export type AllRacesStatus = 'scheduled' | 'running' | 'completed' | 'cancelled' | 'all';

export class AllRacesListItemDTO {
  @ApiProperty()
  id!: string;

  @ApiProperty()
  track!: string;

  @ApiProperty()
  car!: string;

  @ApiProperty()
  scheduledAt!: string;

  @ApiProperty()
  status!: 'scheduled' | 'running' | 'completed' | 'cancelled';

  @ApiProperty()
  leagueId!: string;

  @ApiProperty()
  leagueName!: string;

  @ApiProperty({ nullable: true })
  strengthOfField!: number | null;
}

export class AllRacesStatusFilterDTO {
  @ApiProperty()
  value!: AllRacesStatus;

  @ApiProperty()
  label!: string;
}

export class AllRacesLeagueFilterDTO {
  @ApiProperty()
  id!: string;

  @ApiProperty()
  name!: string;
}

export class AllRacesFilterOptionsDTO {
  @ApiProperty({ type: [AllRacesStatusFilterDTO] })
  statuses!: AllRacesStatusFilterDTO[];

  @ApiProperty({ type: [AllRacesLeagueFilterDTO] })
  leagues!: AllRacesLeagueFilterDTO[];
}

export class AllRacesPageDTO {
  @ApiProperty({ type: [AllRacesListItemDTO] })
  races!: AllRacesListItemDTO[];

  @ApiProperty({ type: AllRacesFilterOptionsDTO })
  filters!: AllRacesFilterOptionsDTO;
}