import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsArray, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
import { LeagueJoinRequestDTO } from './LeagueJoinRequestDTO';
import { LeagueOwnerSummaryDTO } from './LeagueOwnerSummaryDTO';
import { LeagueAdminConfigDTO } from './LeagueAdminConfigDTO';
import { LeagueAdminProtestsDTO } from './LeagueAdminProtestsDTO';
import { LeagueSeasonSummaryDTO } from './LeagueSeasonSummaryDTO';

export class LeagueAdminDTO {
  @ApiProperty({ type: [LeagueJoinRequestDTO] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => LeagueJoinRequestDTO)
  joinRequests!: LeagueJoinRequestDTO[];

  @ApiProperty({ type: () => LeagueOwnerSummaryDTO, nullable: true })
  @IsOptional()
  @ValidateNested()
  @Type(() => LeagueOwnerSummaryDTO)
  ownerSummary!: LeagueOwnerSummaryDTO | null;

  @ApiProperty({ type: () => LeagueAdminConfigDTO })
  @ValidateNested()
  @Type(() => LeagueAdminConfigDTO)
  config!: LeagueAdminConfigDTO;

  @ApiProperty({ type: () => LeagueAdminProtestsDTO })
  @ValidateNested()
  @Type(() => LeagueAdminProtestsDTO)
  protests!: LeagueAdminProtestsDTO;

  @ApiProperty({ type: [LeagueSeasonSummaryDTO] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => LeagueSeasonSummaryDTO)
  seasons!: LeagueSeasonSummaryDTO[];
}