/**
 * PostNL Ecommerce APIsLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { number, object, optional, Schema } from '../schema';

/** Note: Length, Width, Height values are about the order of the size and need to be filled in from the longest to the shortest value. For example: shipment’s official height is 700mm, width 500mm, length 300mm. The longest side (highest value) of 700mm needs to be entered at Length. Width value becomes 500mm, Height value: 300mm (the lowest). Entering the dimensions in the wrong order may result in incorrect shipping labels and longer delivery times. The maximum dimensions can be found in your PostNL contract. */
export interface Dimension {
  /** The shortest side of the shipment in millimeters (mm). */
  height?: number;
  /** The longest side of the shipment in millimeters (mm). */
  length?: number;
  /** Volume of the shipment in centimeters (cm3). Mandatory for E@H-products. */
  volume?: number;
  /** Weight of the shipment in grams. Approximate weight suffices */
  weight: number;
  /** The second longest side of the shipment in millimeters (mm). */
  width?: number;
}

export const dimensionSchema: Schema<Dimension> = object({
  height: ['Height', optional(number())],
  length: ['Length', optional(number())],
  volume: ['Volume', optional(number())],
  weight: ['Weight', number()],
  width: ['Width', optional(number())],
});
