import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsBoolean, IsIn, IsInt, IsOptional, IsString, Max, MaxLength, Min } from 'class-validator'; export class CreatePriorityConfigDto { @ApiProperty({ description: 'Config type: WAGON, CURRENCY, or CUSTOMS', enum: ['WAGON', 'CURRENCY', 'CUSTOMS'], }) @IsIn(['WAGON', 'CURRENCY', 'CUSTOMS']) type!: 'WAGON' | 'CURRENCY' | 'CUSTOMS'; @ApiProperty({ description: 'Human-readable label', maxLength: 100 }) @IsString() @MaxLength(100) label!: string; @ApiPropertyOptional({ description: 'Currency code (e.g., USD, ETB). Required for type=CURRENCY, must be null for type=WAGON and type=CUSTOMS', maxLength: 5, }) @IsOptional() @IsString() @MaxLength(5) currency?: string; @ApiProperty({ description: 'Minimum wagon count in range (inclusive)' }) @IsInt() @Min(0) minWagonCount!: number; @ApiProperty({ description: 'Maximum wagon count in range (inclusive)' }) @IsInt() @Min(0) maxWagonCount!: number; @ApiProperty({ description: 'Points awarded when booking matches this rule. Capped so the priority blocks sum to ≤ 100 alongside the service-type bonus (service ≤ 15 + wagon ≤ 50 + currency ≤ 35). WAGON configs should not exceed 50; CURRENCY configs should not exceed 35.', default: 0, maximum: 50, }) @IsInt() @Min(0) @Max(50) scorePoints!: number; @ApiPropertyOptional({ default: false, description: 'Feature flag — toggle without code deploy' }) @IsOptional() @IsBoolean() isActive?: boolean; }