{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/portbase/main/json-schema/portbase-shipment-schema.json",
  "title": "Shipment",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/portbase-cargo-controller-import-openapi.yml#/components/schemas/Shipment",
  "type": "object",
  "properties": {
    "deepSeaEta": {
      "type": "string",
      "description": "Estimated time of arrival of the deepsea vessel at the terminal. Format: yyyy-MM-ddThh:mm:ssZ",
      "minLength": 1
    },
    "deepSeaTerminal": {
      "type": "string",
      "description": "Code of the terminal. Possible values: SMDGn BICS code or Portbase short name. E.g.: MDT, NLMVII, DCD, EMX, RWG, RST. This value will be provided by the API updates.",
      "minLength": 1
    },
    "deepSeaVesselName": {
      "type": "string",
      "description": "Name of the deepsea vessel that is delivering the cargo"
    },
    "deepSeaVesselImo": {
      "type": "string",
      "description": "IMO code of the deepsea vessel that is delivering the cargo"
    },
    "deepSeaVoyageNumber": {
      "type": "string",
      "description": "Voyage number of the deepsea vessel that is delivering the cargo"
    },
    "transportEquipments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/TransportEquipmentDto"
      }
    }
  },
  "required": [
    "deepSeaEta",
    "deepSeaTerminal"
  ],
  "$defs": {
    "TransportEquipmentDto": {
      "type": "object",
      "properties": {
        "equipmentNumber": {
          "type": "string",
          "description": "Transport equipment number (for example a container number)",
          "minLength": 1
        },
        "sizeType": {
          "type": "string",
          "description": "Size type code (e.g. 4230) of the container",
          "maxLength": 4,
          "minLength": 4
        },
        "containerOperator": {
          "type": "string",
          "description": "Carrier (i.e. shipping company) responsible for the deep sea transport of the cargo. Possible values: A 4-letter SCAC (Standard Carrier Alpha Code) or Portbase short name.",
          "minLength": 1
        },
        "placeOfDestination": {
          "type": "string",
          "description": "Final destination of the cargo, preferably UN code but name is also allowed",
          "maxLength": 2,
          "minLength": 2
        },
        "inlandTerminalLocation": {
          "type": "string",
          "description": "Location UN code of the inland terminal",
          "maxLength": 2,
          "minLength": 2
        },
        "inlandTerminalCode": {
          "type": "string",
          "description": "BICS code of the inland terminal. See https://binnenvaart.org/terminal-codes/ for all the barge terminals."
        },
        "inlandOperator": {
          "type": "string",
          "description": "Operator authorised to perform the inland transport of the cargo. Value: EAN code"
        },
        "inlandModality": {
          "type": "string",
          "description": "The modality of the inland transport. Possible values: barge, rail or road",
          "enum": [
            "barge",
            "rail",
            "road"
          ],
          "pattern": "barge|rail|road"
        },
        "releaseReference": {
          "type": "string",
          "description": "Reference number (i.e. pin code) from the carrier after the cargo’s commercial release"
        },
        "transportOrder": {
          "$ref": "#/$defs/TransportOrder",
          "description": "Details relating to the transport order given by the cargo director to the inland operator"
        }
      },
      "required": [
        "containerOperator",
        "equipmentNumber"
      ]
    },
    "TransportOrder": {
      "type": "object",
      "properties": {
        "invoiceReference": {
          "type": "string",
          "description": "Reference to use when invoicing the inland transport"
        },
        "debtorName": {
          "type": "string",
          "description": "Name of party that owes money for the inland transport"
        },
        "consigneeName": {
          "type": "string",
          "description": "Name of the consignee that is importing the cargo"
        },
        "releaseExpiration": {
          "type": "string",
          "description": "Expiration moment of the commercial release. Format: yyyy-MM-ddThh:mm:ssZ"
        },
        "demurrage": {
          "type": "string",
          "description": "Number of free days at terminal. Number in whole days.",
          "pattern": "[0-9]+"
        },
        "detention": {
          "type": "string",
          "description": "Number of free days to deliver equipment to inland terminal. Number in whole days.",
          "pattern": "[0-9]+"
        },
        "returnTerminal": {
          "type": "string",
          "description": "The name of the terminal or depot where the empty equipment is returned. Preferably BICS or SMDG code but name is also allowed."
        },
        "returnReference": {
          "type": "string",
          "description": "The code that is required by terminal or depot to accept the equipment"
        },
        "destinationTargetDate": {
          "type": "string",
          "description": "Date on which the equipment preferably should have reached the destination. Format: yyyy-MM-dd"
        },
        "destinationReference": {
          "type": "string",
          "description": "The code that is required by the inland terminal to accept the empty equipment"
        },
        "destinationInstructions": {
          "type": "string",
          "description": "Instructions on how to deliver the equipment at the destination"
        },
        "customsCategory": {
          "type": "string",
          "description": "Three-letter customs category code for the inland transport. Possible values: IM4,MRN,DIN,FWV,ICT,NAR,NT1,BXI,TNK,PIE,PPZ.",
          "maxLength": 3,
          "minLength": 3
        },
        "documentNumber": {
          "type": "string",
          "description": "The movement reference number (MRN) from customs of the inland movement"
        },
        "documentExpiration": {
          "type": "string",
          "description": "Expiration date of MRN document. Format: yyyy-MM-dd"
        }
      }
    }
  }
}