import { ApiProperty } from '@nestjs/swagger';
import { CargoUnitOfMeasure } from '@edr/types';

/** A single contracted/ordered/remaining pool line for a general contract. */
export class ContractQuantityLineView {
  @ApiProperty({ nullable: true, description: 'Container type id (null for bulk/break-bulk)' })
  containerTypeId!: string | null;

  @ApiProperty({ nullable: true })
  containerTypeName!: string | null;

  @ApiProperty({ enum: CargoUnitOfMeasure, nullable: true })
  unitOfMeasure!: CargoUnitOfMeasure | null;

  @ApiProperty()
  contractedQuantity!: number;

  @ApiProperty()
  orderedQuantity!: number;

  @ApiProperty()
  remainingQuantity!: number;
}

/** A contracted/ordered/remaining pool line for one route of a general contract. */
export class ContractRouteLineView {
  @ApiProperty({ description: 'Contract route line id' })
  routeLineId!: string;

  @ApiProperty()
  originYardId!: string;

  @ApiProperty({ nullable: true })
  originYardName!: string | null;

  @ApiProperty()
  destinationYardId!: string;

  @ApiProperty({ nullable: true })
  destinationYardName!: string | null;

  @ApiProperty({ nullable: true, description: 'Container type id (null for bulk/break-bulk)' })
  containerTypeId!: string | null;

  @ApiProperty({ nullable: true })
  containerTypeName!: string | null;

  @ApiProperty()
  contractedQuantity!: number;

  @ApiProperty()
  orderedQuantity!: number;

  @ApiProperty()
  remainingQuantity!: number;

  @ApiProperty({ nullable: true, description: 'Road distance (km); used to bill road orders' })
  km!: number | null;
}
