import { ApiProperty } from '@nestjs/swagger';
import { ArrayMinSize, IsArray, IsUUID, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';

export class PinWagonAssignmentDto {
  @ApiProperty({ format: 'uuid' })
  @IsUUID()
  trainSetWagonId!: string;

  @ApiProperty({ format: 'uuid' })
  @IsUUID()
  physicalWagonId!: string;
}

export class PinWagonsDto {
  @ApiProperty({ type: [PinWagonAssignmentDto] })
  @IsArray()
  @ArrayMinSize(1)
  @ValidateNested({ each: true })
  @Type(() => PinWagonAssignmentDto)
  assignments!: PinWagonAssignmentDto[];
}
