import { ApiPropertyOptional } from '@nestjs/swagger'; import { IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator'; /** * Edit a built train's display identity: its name and its fixed import/export * run numbers. Composition (yard, locomotives, wagons) has its own endpoints. * Omitted fields keep their current value; an empty trainName clears the name. */ export class UpdateTrainDetailsDto { @ApiPropertyOptional({ description: 'Display name; empty string clears it' }) @IsOptional() @IsString() @MaxLength(100) trainName?: string; @ApiPropertyOptional({ description: 'Fixed IMPORT (even) run number' }) @IsOptional() @IsString() @IsNotEmpty() @MaxLength(20) importTrainNumber?: string; @ApiPropertyOptional({ description: 'Fixed EXPORT (odd) run number' }) @IsOptional() @IsString() @IsNotEmpty() @MaxLength(20) exportTrainNumber?: string; }