{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/digitraffic-fi/json-schema/digitraffic-fi-port-calls-v1-schema.json",
  "title": "PortCallsV1",
  "description": "Port call",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/digitraffic-fi-port-call-v1-api-openapi.yml#/components/schemas/PortCallsV1",
  "required": [
    "dataUpdatedTime",
    "portCalls"
  ],
  "type": "object",
  "properties": {
    "dataUpdatedTime": {
      "type": "string",
      "description": "Timestamp when port calls were updated",
      "format": "date-time"
    },
    "portCalls": {
      "type": "array",
      "description": "Port calls",
      "items": {
        "$ref": "#/$defs/PortCallJsonV1"
      }
    }
  },
  "$defs": {
    "AgentInfoJsonV1": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the agent"
        },
        "portCallDirection": {
          "type": "string",
          "description": "Port call direction"
        },
        "ediNumber": {
          "type": "string",
          "description": "Electronic data interchange number"
        },
        "role": {
          "type": "integer",
          "description": "Role of the agent",
          "format": "int32"
        }
      },
      "description": "Agent info"
    },
    "ImoInformationJsonV1": {
      "type": "object",
      "properties": {
        "imoGeneralDeclaration": {
          "type": "string",
          "description": "Tells whether information concerns Departure or Arrival"
        },
        "briefParticularsVoyage": {
          "type": "string",
          "description": "Brief particular information of voyage. Previous and following ports for example."
        },
        "portOfDischarge": {
          "type": "string",
          "description": "Code of port where discharge occurs"
        },
        "numberOfCrew": {
          "type": "integer",
          "description": "Number of crew",
          "format": "int32"
        },
        "numberOfPassangers": {
          "type": "integer",
          "description": "Number of passengers",
          "format": "int32"
        },
        "cargoDeclarationOb": {
          "type": "integer",
          "description": "Number of cargo declarations on board",
          "format": "int32"
        },
        "crewListsOb": {
          "type": "integer",
          "description": "Number of crew lists on board",
          "format": "int32"
        },
        "crewsEffectsDeclarationsOb": {
          "type": "integer",
          "description": "Number of crew effect declarations on board",
          "format": "int32"
        },
        "shipStoresDeclarationsOb": {
          "type": "integer",
          "description": "Number of ship store declarations on board",
          "format": "int32"
        },
        "passangerListsOb": {
          "type": "integer",
          "description": "Number of passenger lists on board",
          "format": "int32"
        },
        "healthDeclarationsOb": {
          "type": "integer",
          "description": "Number of health care declarations on board",
          "format": "int32"
        }
      },
      "description": "IMO information"
    },
    "PortAreaDetailsJsonV1": {
      "type": "object",
      "properties": {
        "etaTimestamp": {
          "type": "string",
          "description": "Update time of ETA. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "etaSource": {
          "type": "string",
          "description": "Source of ETA"
        },
        "etd": {
          "type": "string",
          "description": "Estimated time of departure. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "etdTimestamp": {
          "type": "string",
          "description": "Update time of ETD. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "etdSource": {
          "type": "string",
          "description": "Source of ETD"
        },
        "ata": {
          "type": "string",
          "description": "Actual time of arrival. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "ataTimestamp": {
          "type": "string",
          "description": "Update time of ATA. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "ataSource": {
          "type": "string",
          "description": "Source of ATA"
        },
        "atd": {
          "type": "string",
          "description": "Actual time of departure. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "atdTimestamp": {
          "type": "string",
          "description": "Update time of ATD. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "atdSource": {
          "type": "string",
          "description": "Source of ATD"
        },
        "arrivalDraught": {
          "type": "number",
          "description": "Arrival draught"
        },
        "departureDraught": {
          "type": "number",
          "description": "Departure draught"
        },
        "berthName": {
          "type": "string",
          "description": "Berth name"
        },
        "portAreaName": {
          "type": "string",
          "description": "Port area name"
        },
        "eta": {
          "type": "string",
          "description": "Estimated time of arrival. Set by ship agent, port or pilot.",
          "format": "date-time"
        },
        "portAreaCode": {
          "type": "string",
          "description": "Port area code"
        },
        "berthCode": {
          "type": "string",
          "description": "Berth code"
        }
      },
      "description": "Port area details"
    },
    "PortCallJsonV1": {
      "required": [
        "portCallId"
      ],
      "type": "object",
      "properties": {
        "portCallId": {
          "type": "integer",
          "description": "Unique identifier for port call",
          "format": "int64"
        },
        "portCallTimestamp": {
          "type": "string",
          "description": "Port call information modification time",
          "format": "date-time"
        },
        "customsReference": {
          "type": "string",
          "description": "Custom's reference"
        },
        "portToVisit": {
          "type": "string",
          "description": "Code of the port to visit"
        },
        "prevPort": {
          "type": "string",
          "description": "Code of the previous port"
        },
        "nextPort": {
          "type": "string",
          "description": "Code of the next port"
        },
        "domesticTrafficArrival": {
          "type": "boolean",
          "description": "Is this a domestic arrival"
        },
        "domesticTrafficDeparture": {
          "type": "boolean",
          "description": "Is this a domestic departure"
        },
        "arrivalWithCargo": {
          "type": "boolean",
          "description": "Does the ship arrive with cargo"
        },
        "notLoading": {
          "type": "boolean",
          "description": "Does the ship load"
        },
        "discharge": {
          "type": "integer",
          "description": "Type of discharge<br>1: Unloads all cargo<br>2: Unloads part of cargo<br>3: Does not unload cargo<br>4: Ship arriving in ballast cargo",
          "format": "int32",
          "enum": [
            1,
            2,
            3,
            4
          ]
        },
        "shipMasterArrival": {
          "type": "string",
          "description": "Ship master at the moment of arrival(deprecated)"
        },
        "shipMasterDeparture": {
          "type": "string",
          "description": "Ship master at the moment of departure(deprecated)"
        },
        "managementNameArrival": {
          "type": "string",
          "description": "Ship management name at moment of arrival"
        },
        "managementNameDeparture": {
          "type": "string",
          "description": "Ship management name at moment of departure"
        },
        "forwarderNameArrival": {
          "type": "string",
          "description": "Forwarder at moment of arrival"
        },
        "forwarderNameDeparture": {
          "type": "string",
          "description": "Forwarder at moment of departure"
        },
        "freeTextArrival": {
          "type": "string",
          "description": "Notes concerning arrival"
        },
        "freeTextDeparture": {
          "type": "string",
          "description": "Notes concerning departure"
        },
        "vesselName": {
          "type": "string",
          "description": "Vessel name"
        },
        "vesselNamePrefix": {
          "type": "string",
          "description": "Vessel name prefix"
        },
        "radioCallSign": {
          "type": "string",
          "description": "Ship radio call sign"
        },
        "radioCallSignType": {
          "type": "string",
          "description": "Ship radio call sign type"
        },
        "imoLloyds": {
          "type": "integer",
          "description": "Ship IMO / Lloyds",
          "format": "int32"
        },
        "mmsi": {
          "type": "integer",
          "description": "Ship MMSI (Maritime Mobile Service Identity)",
          "format": "int32"
        },
        "nationality": {
          "type": "string",
          "description": "Ship nationality"
        },
        "vesselTypeCode": {
          "type": "integer",
          "description": "Ship Vessel Type Code",
          "format": "int32"
        },
        "certificateIssuer": {
          "type": "string",
          "description": "Name of certificate issuer"
        },
        "certificateStartDate": {
          "type": "string",
          "description": "Certificate start date",
          "format": "date-time"
        },
        "certificateEndDate": {
          "type": "string",
          "description": "Certificate end date",
          "format": "date-time"
        },
        "currentSecurityLevel": {
          "type": "integer",
          "description": "Current security level. 1 = normal security level, 2 = raised security level, 3 = exceptional security level",
          "format": "int32"
        },
        "agentInfo": {
          "uniqueItems": true,
          "type": "array",
          "description": "Ship agents",
          "items": {
            "$ref": "#/$defs/AgentInfoJsonV1"
          }
        },
        "imoInformation": {
          "uniqueItems": true,
          "type": "array",
          "description": "IMO information",
          "items": {
            "$ref": "#/$defs/ImoInformationJsonV1"
          }
        },
        "portAreaDetails": {
          "uniqueItems": true,
          "type": "array",
          "description": "Port area details",
          "items": {
            "$ref": "#/$defs/PortAreaDetailsJsonV1"
          }
        }
      },
      "description": "Port call"
    }
  }
}