import { ApiProperty } from '@nestjs/swagger';
import { IsEnum, IsString, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
import { DriverDTO } from '../../driver/dtos/DriverDTO';

export class LeagueMemberDTO {
  @ApiProperty()
  @IsString()
  driverId!: string;

  @ApiProperty({ type: () => DriverDTO })
  @ValidateNested()
  @Type(() => DriverDTO)
  driver!: DriverDTO;

  @ApiProperty({ enum: ['owner', 'admin', 'steward', 'member'] })
  @IsEnum(['owner', 'admin', 'steward', 'member'])
  role!: 'owner' | 'admin' | 'steward' | 'member';

  @ApiProperty({ description: 'ISO-8601 timestamp' })
  @IsString()
  joinedAt!: string;
}