{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trackingmcp-com/json-schema/trackingmcp-com-dcsa-event-schema.json",
  "title": "DcsaEvent",
  "description": "A DCSA Track & Trace 2.2 event. Common fields plus a per-type block (SHIPMENT / TRANSPORT / EQUIPMENT). Null/absent fields are omitted from the payload rather than sent as null.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/trackingmcp-com-openapi.json#/components/schemas/DcsaEvent",
  "type": "object",
  "properties": {
    "eventID": {
      "type": "string",
      "format": "uuid"
    },
    "eventCreatedDateTime": {
      "type": "string",
      "format": "date-time"
    },
    "eventType": {
      "type": "string",
      "enum": [
        "SHIPMENT",
        "TRANSPORT",
        "EQUIPMENT"
      ]
    },
    "eventClassifierCode": {
      "type": "string",
      "enum": [
        "ACT",
        "PLN",
        "EST"
      ],
      "description": "ACT = actual (happened), EST = estimated, PLN = planned. Never assume a PLN/EST move has occurred."
    },
    "eventDateTime": {
      "type": "string",
      "format": "date-time"
    },
    "equipmentEventTypeCode": {
      "type": "string",
      "description": "EQUIPMENT events only. E.g. GTOT (gate-out), GTIN (gate-in), LOAD, DISC, PICK, DROP.",
      "enum": [
        "LOAD",
        "DISC",
        "GTIN",
        "GTOT",
        "STUF",
        "STRP",
        "PICK",
        "DROP",
        "INSP",
        "RSEA",
        "RMVD"
      ]
    },
    "emptyIndicatorCode": {
      "type": "string",
      "enum": [
        "EMPTY",
        "LADEN"
      ],
      "description": "EQUIPMENT events only. Present ONLY when the carrier reported the fill state (a minority of events). Absent when not reported — DCSA has no 'unknown' value and we do not fabricate one. Not a reliable end-of-shipment signal; use the container `status` field instead."
    },
    "emptyIndicatorSource": {
      "type": "string",
      "enum": [
        "carrier",
        "not_reported"
      ],
      "description": "Extension, EQUIPMENT events only. carrier when the line reported emptyIndicatorCode, not_reported when it did not (emptyIndicatorCode is then absent). We never fill the gap ourselves."
    },
    "equipmentReference": {
      "type": "string",
      "description": "Container number."
    },
    "ISOEquipmentCode": {
      "type": [
        "string",
        "null"
      ]
    },
    "transportEventTypeCode": {
      "type": "string",
      "description": "TRANSPORT events only. E.g. ARRI (arrival), DEPA (departure).",
      "enum": [
        "ARRI",
        "DEPA"
      ]
    },
    "shipmentEventTypeCode": {
      "type": [
        "string",
        "null"
      ],
      "description": "SHIPMENT events only."
    },
    "transportCall": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "transportCallID": {
          "type": "string",
          "description": "Identifier of the call."
        },
        "modeOfTransport": {
          "type": "string",
          "description": "Mode of transport, for example VESSEL, RAIL, TRUCK, BARGE."
        },
        "facilityTypeCode": {
          "type": "string",
          "description": "Facility type code."
        },
        "carrierVoyageNumber": {
          "type": "string",
          "description": "Voyage number of the line."
        },
        "exportVoyageNumber": {
          "type": "string",
          "description": "Export voyage number; falls back to carrierVoyageNumber."
        },
        "importVoyageNumber": {
          "type": "string",
          "description": "Import voyage number."
        },
        "carrierServiceCode": {
          "type": "string",
          "description": "Service code of the line."
        },
        "UNLocationCode": {
          "type": "string",
          "description": "UN/LOCODE of the call."
        },
        "facilityCode": {
          "type": "string",
          "description": "Facility code."
        },
        "facilityCodeListProvider": {
          "type": "string",
          "description": "Code list of facilityCode."
        },
        "location": {
          "type": "object",
          "properties": {
            "locationName": {
              "type": "string",
              "description": "Name of the place."
            },
            "UNLocationCode": {
              "type": "string",
              "description": "UN/LOCODE of the place."
            },
            "facilityCode": {
              "type": "string",
              "description": "Facility code."
            },
            "facilityCodeListProvider": {
              "type": "string",
              "description": "Code list of facilityCode."
            },
            "latitude": {
              "type": "string",
              "description": "Latitude as a string."
            },
            "longitude": {
              "type": "string",
              "description": "Longitude as a string."
            }
          },
          "description": "Where the event took place. Empty keys are omitted."
        },
        "vessel": {
          "type": "string",
          "description": "Vessel name (a string, not an object)."
        },
        "vesselIMONumber": {
          "type": "string",
          "description": "IMO number of the vessel."
        }
      },
      "description": "Location / vessel / voyage of the call."
    },
    "documentID": {
      "type": "string",
      "description": "SHIPMENT events only: document the event is about."
    },
    "documentTypeCode": {
      "type": "string",
      "description": "SHIPMENT events only."
    },
    "reason": {
      "type": "string",
      "description": "SHIPMENT events only."
    },
    "delayReasonCode": {
      "type": "string",
      "description": "TRANSPORT events only."
    },
    "changeRemark": {
      "type": "string",
      "description": "TRANSPORT events only."
    },
    "eventLocation": {
      "type": "object",
      "properties": {
        "locationName": {
          "type": "string",
          "description": "Name of the place."
        },
        "UNLocationCode": {
          "type": "string",
          "description": "UN/LOCODE of the place."
        },
        "facilityCode": {
          "type": "string",
          "description": "Facility code."
        },
        "facilityCodeListProvider": {
          "type": "string",
          "description": "Code list of facilityCode."
        },
        "latitude": {
          "type": "string",
          "description": "Latitude as a string."
        },
        "longitude": {
          "type": "string",
          "description": "Longitude as a string."
        }
      },
      "description": "Where the event took place. Empty keys are omitted."
    },
    "documentReferences": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "documentReferenceType": {
            "type": "string",
            "description": "Type of the reference."
          },
          "documentReferenceValue": {
            "type": "string",
            "description": "The reference."
          }
        }
      }
    },
    "references": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        }
      }
    },
    "seals": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        }
      }
    },
    "trackingMcpSource": {
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "const": "trackingmcp",
          "description": "Always trackingmcp."
        },
        "normalisationConfidence": {
          "type": "string",
          "description": "Confidence of the normalisation, UNKNOWN when not recorded, INFERRED on events expanded for a child container."
        },
        "rawEventCode": {
          "type": "string",
          "description": "The original event code or wording."
        },
        "carrierStatusText": {
          "type": "string",
          "description": "The status wording of the line, verbatim, when stated."
        }
      }
    }
  },
  "required": [
    "eventID",
    "eventType",
    "eventClassifierCode",
    "eventDateTime"
  ]
}