mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 06:28:12 +00:00
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { IsBoolean, IsEnum, IsNumber, IsOptional, IsUUID, Min } from 'class-validator';
|
|
import { Freight } from '@edr/types';
|
|
|
|
export class CreateWeightLimitRuleDto {
|
|
@ApiProperty({ description: 'FK to container_types.id' })
|
|
@IsUUID()
|
|
containerTypeId!: string;
|
|
|
|
@ApiProperty({ enum: Freight.TradeDirection, description: 'Trade direction this rule applies to' })
|
|
@IsEnum(Freight.TradeDirection)
|
|
tradeDirection!: Freight.TradeDirection;
|
|
|
|
@ApiProperty({ description: 'Maximum allowed weight in tons before surcharge is applied' })
|
|
@IsNumber()
|
|
@Min(0)
|
|
maxWeightTons!: number;
|
|
|
|
@ApiProperty({ description: 'Weight at which a warning is issued (must be ≤ maxWeightTons)' })
|
|
@IsNumber()
|
|
@Min(0)
|
|
warningThresholdTons!: number;
|
|
|
|
@ApiPropertyOptional({ enum: Freight.ExceededAction, default: Freight.ExceededAction.WARNING_ONLY })
|
|
@IsOptional()
|
|
@IsEnum(Freight.ExceededAction)
|
|
exceededAction?: Freight.ExceededAction;
|
|
|
|
@ApiPropertyOptional({ description: 'FK to surcharges.id — surcharge billed when max is exceeded' })
|
|
@IsOptional()
|
|
@IsUUID()
|
|
surchargeId?: string;
|
|
|
|
@ApiPropertyOptional({ default: true })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isActive?: boolean;
|
|
}
|