import { ApiPropertyOptional } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsInt, IsNumber, IsOptional, Max, Min } from 'class-validator'; export class UpdateTrainSchedulingGlobalRulesDto { @ApiPropertyOptional({ example: 760 }) @IsOptional() @Type(() => Number) @IsNumber() @Min(1) maxTrainLengthMeters?: number; @ApiPropertyOptional({ example: 3500 }) @IsOptional() @Type(() => Number) @IsNumber() @Min(1) maxTrainWeightTons?: number; @ApiPropertyOptional({ example: 53 }) @IsOptional() @Type(() => Number) @IsInt() @Min(1) maxWagonsPerTrain?: number; @ApiPropertyOptional({ example: 30 }) @IsOptional() @Type(() => Number) @IsNumber() @Min(0.001) max20ftContainerWeightTons?: number; @ApiPropertyOptional({ example: 10 }) @IsOptional() @Type(() => Number) @IsNumber() @Min(0) max20ftPairWeightDiffTons?: number; @ApiPropertyOptional({ example: 3, description: 'Days before departure the import booking-window day falls on' }) @IsOptional() @Type(() => Number) @IsInt() @Min(0) importWindowLeadDays?: number; @ApiPropertyOptional({ example: 24, description: 'Hours before departure an export booking becomes acceptable' }) @IsOptional() @Type(() => Number) @IsInt() @Min(1) exportBookingLeadHours?: number; @ApiPropertyOptional({ example: 8, description: 'Local EAT hour the import window opens each day' }) @IsOptional() @Type(() => Number) @IsInt() @Min(0) @Max(23) windowOpenHour?: number; @ApiPropertyOptional({ example: 17, description: 'Local EAT hour the booking desk shuts each day; a not-yet-full window resumes next morning at windowOpenHour. Equal to windowOpenHour = 24-hour desk', }) @IsOptional() @Type(() => Number) @IsInt() @Min(0) @Max(23) windowCloseHour?: number; // Stored in hours. The UI enters this in minutes/hours/days and converts to // hours before sending, so the floor is 1 minute (0.0166h) — not 15 min. @ApiPropertyOptional({ example: 3 }) @IsOptional() @Type(() => Number) @IsNumber() @Min(0.0166) @Max(12) windowDurationHours?: number; @ApiPropertyOptional({ example: 30 }) @IsOptional() @Type(() => Number) @IsInt() @Min(0) docReviewMinutes?: number; @ApiPropertyOptional({ example: 60 }) @IsOptional() @Type(() => Number) @IsInt() @Min(1) paymentWindowMinutes?: number; @ApiPropertyOptional({ example: 90 }) @IsOptional() @Type(() => Number) @IsInt() @Min(1) reopenDelayMinutes?: number; }