import { Type } from 'class-transformer'; import { ArrayMaxSize, ArrayMinSize, IsArray, IsInt, IsString, Min, ValidateNested, } from 'class-validator'; export class ExchangeItemDto { @IsString() itemKey!: string; @IsInt() @Min(1) quantity!: number; } export class ExchangeRequestDto { /** * Item keys and quantities only. * * Prices and rewards are never accepted from the client -- the server reads * them from the exchange rules (slice §8, NPC spec §37.9). The upper bound * keeps one request from turning into an unbounded row-by-row transaction. */ @IsArray() @ArrayMinSize(1) @ArrayMaxSize(50) @ValidateNested({ each: true }) @Type(() => ExchangeItemDto) items!: ExchangeItemDto[]; }