import { ApiProperty } from '@nestjs/swagger';

export class PriceLineItemDto {
  @ApiProperty()
  code!: string;

  @ApiProperty()
  description!: string;

  /** Computed line total (unitAmount × quantity). Retained for totals elsewhere. */
  @ApiProperty()
  amount!: number;

  /** Price for a single unit of this charge (e.g. one 20ft container, one ton). */
  @ApiProperty()
  unitAmount!: number;

  /** Unit the rate is charged per: PER_CONTAINER | PER_TON | PER_WAGON | PER_KM | FLAT. */
  @ApiProperty()
  unit!: string;

  /** How many units this charge applies to (containers, tons, wagons; 1 for FLAT). */
  @ApiProperty()
  quantity!: number;

  @ApiProperty()
  currency!: string;
}

export class GeneratePriceResponseDto {
  @ApiProperty()
  bookingId!: string;

  @ApiProperty()
  totalAmount!: number;

  @ApiProperty()
  currency!: string;

  @ApiProperty({ type: [PriceLineItemDto] })
  lineItems!: PriceLineItemDto[];

  @ApiProperty({ type: [String] })
  warnings!: string[];
}
