import { Type } from 'class-transformer'; import { ArrayMaxSize, ArrayMinSize, IsArray, IsEnum, IsInt, IsMongoId, IsOptional, Max, Min, ValidateNested, } from 'class-validator'; import { AUCTION_TOP_TIER_THRESHOLDS } from '../../global/database/schema'; export type AuctionTopTierThreshold = (typeof AUCTION_TOP_TIER_THRESHOLDS)[number]; class CaptainAssignmentDto { @IsInt() @Min(1) teamIndex!: number; @IsMongoId() userId!: string; @IsOptional() @IsInt() @Min(100) @Max(100000) initialPoints?: number; } export class StartAuctionDto { @IsArray() @ArrayMinSize(2) @ArrayMaxSize(16) @ValidateNested({ each: true }) @Type(() => CaptainAssignmentDto) captains!: CaptainAssignmentDto[]; @IsOptional() @IsInt() @Min(100) @Max(100000) initialPoints?: number; @IsOptional() @IsEnum(AUCTION_TOP_TIER_THRESHOLDS) topTierThreshold?: AuctionTopTierThreshold; @IsOptional() @IsArray() @ArrayMaxSize(100) @IsMongoId({ each: true }) manualTopTierUserIds?: string[]; @IsOptional() @IsInt() @Min(5) maxTimerSeconds?: number; @IsOptional() @IsInt() @Min(0) bidExtensionSeconds?: number; } export class PlaceBidDto { @IsInt() @Min(1) teamIndex!: number; @IsInt() @Min(1) amount!: number; @IsOptional() @IsMongoId() bidderUserId?: string; } export class SoldDto { @IsOptional() @IsEnum(['TOP', 'JGL', 'MID', 'ADC', 'SUP']) assignedPosition?: 'TOP' | 'JGL' | 'MID' | 'ADC' | 'SUP'; } export class UndoAuctionDto { @IsInt() @Min(1) sequence!: number; }