import { ApiPropertyOptional } from '@nestjs/swagger'; import { IsOptional, IsString, MaxLength } from 'class-validator'; /** * Edit a departure's operational run identifiers. Both fields are optional so * either can be corrected alone; the service rejects a body carrying neither, * so an empty request cannot write an audit row for a no-op. * * Sending an empty string clears the field; omitting it leaves it unchanged. */ export class UpdateScheduleTrainNumberDto { @ApiPropertyOptional({ example: '9201', description: "Run number for this departure. Empty string clears it.", maxLength: 20, }) @IsOptional() @IsString() @MaxLength(20) trainNumber?: string; @ApiPropertyOptional({ example: 'V-2026-014', description: 'Voyage (sailing) number for this departure. Empty string clears it.', maxLength: 20, }) @IsOptional() @IsString() @MaxLength(20) voyageNumber?: string; @ApiPropertyOptional({ description: 'Why the numbers changed — kept on the audit trail.', maxLength: 500, }) @IsOptional() @IsString() @MaxLength(500) reason?: string; }