mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import {
|
|
IsBoolean,
|
|
IsEnum,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
Length,
|
|
MaxLength,
|
|
Min,
|
|
} from 'class-validator';
|
|
import { Freight } from '@edr/types';
|
|
|
|
export class CreateSurchargeDto {
|
|
@ApiProperty({ description: 'FK to surcharge_types.id' })
|
|
@IsUUID()
|
|
surchargeTypeId!: string;
|
|
|
|
@ApiProperty({ description: 'Display name for this surcharge line item', maxLength: 255 })
|
|
@IsString()
|
|
@MaxLength(255)
|
|
feeName!: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Human-readable description of when this surcharge is triggered' })
|
|
@IsOptional()
|
|
@IsString()
|
|
triggerDescription?: string;
|
|
|
|
@ApiProperty({ enum: Freight.CalculationMethod, default: Freight.CalculationMethod.PER_TON })
|
|
@IsEnum(Freight.CalculationMethod)
|
|
calculationMethod!: Freight.CalculationMethod;
|
|
|
|
@ApiProperty({ description: 'Rate amount (per ton, flat, or percentage)' })
|
|
@IsNumber()
|
|
@Min(0)
|
|
rate!: number;
|
|
|
|
@ApiProperty({ description: 'ISO 4217 currency code', default: 'USD' })
|
|
@IsString()
|
|
@Length(3, 3)
|
|
currency!: string;
|
|
|
|
@ApiPropertyOptional({ default: false })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
applyToRail?: boolean;
|
|
|
|
@ApiPropertyOptional({ default: false })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
applyToFirstMile?: boolean;
|
|
|
|
@ApiPropertyOptional({ default: false })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
applyToLastMile?: boolean;
|
|
|
|
@ApiPropertyOptional({ default: true })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isActive?: boolean;
|
|
}
|