import { BaseEntity } from '@edr/api-common'; import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm'; import { ContainerType } from './container-type.entity'; @Entity({ schema: 'freight', name: 'weight_limit_rules' }) @Index(['containerTypeId']) @Index(['tradeDirection']) export class WeightLimitRule extends BaseEntity { @Column({ name: 'container_type_id', type: 'uuid' }) containerTypeId!: string; @ManyToOne(() => ContainerType, (ct) => ct.weightLimitRules) @JoinColumn({ name: 'container_type_id' }) containerType!: ContainerType; @Column({ name: 'trade_direction', type: 'varchar', length: 10 }) tradeDirection!: string; @Column({ name: 'max_vgm_tons', type: 'numeric', precision: 8, scale: 3, nullable: true }) maxVgmTons!: number; /** * Absolute per-unit weight ceiling in tons. Weight above maxVgmTons but at or * below this is "overweight" (surcharge + warning); weight above this hard- * blocks booking creation entirely. Null = no ceiling (overweight only). */ @Column({ name: 'max_capacity_tons', type: 'numeric', precision: 8, scale: 3, nullable: true }) maxCapacityTons!: number | null; }