{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/terminal49/json-schema/terminal49-transport-event-schema.json",
  "title": "Transport Event Model",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/terminal49-openapi.json#/components/schemas/transport_event",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "type": {
      "type": "string",
      "enum": [
        "transport_event"
      ]
    },
    "attributes": {
      "type": "object",
      "properties": {
        "event": {
          "type": "string",
          "enum": [
            "container.transport.vessel_arrived",
            "container.transport.estimated.vessel_arrived",
            "container.transport.vessel_discharged",
            "container.transport.vessel_loaded",
            "container.transport.vessel_departed",
            "container.transport.estimated.vessel_departed",
            "container.transport.rail_departed",
            "container.transport.rail_arrived",
            "container.transport.rail_loaded",
            "container.transport.rail_unloaded",
            "container.transport.transshipment_arrived",
            "container.transport.transshipment_discharged",
            "container.transport.transshipment_loaded",
            "container.transport.transshipment_departed",
            "container.transport.feeder_arrived",
            "container.transport.feeder_discharged",
            "container.transport.feeder_loaded",
            "container.transport.feeder_departed",
            "container.transport.empty_out",
            "container.transport.full_in",
            "container.transport.full_out",
            "container.transport.empty_in",
            "container.transport.vessel_berthed",
            "container.transport.arrived_at_inland_destination",
            "container.transport.estimated.arrived_at_inland_destination",
            "container.pickup_lfd.changed",
            "container.pickup_lfd_line.changed",
            "container.pickup_lfd_terminal.changed",
            "container.pickup_lfd_rail.changed",
            "container.pickup_appointment.changed",
            "container.transport.available",
            "container.transport.not_available",
            "container.transport.delivered",
            "document.extracted",
            "document.extraction_failed"
          ]
        },
        "voyage_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "timestamp": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "timezone": {
          "type": [
            "string",
            "null"
          ],
          "description": "IANA tz"
        },
        "location_locode": {
          "type": [
            "string",
            "null"
          ],
          "description": "UNLOCODE of the event location"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "data_source": {
          "type": "string",
          "enum": [
            "shipping_line",
            "terminal",
            "ais"
          ],
          "description": "The original source of the event data"
        }
      }
    },
    "relationships": {
      "type": "object",
      "properties": {
        "shipment": {
          "type": "object",
          "properties": {
            "data": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "shipment"
                  ]
                }
              }
            }
          }
        },
        "location": {
          "type": "object",
          "properties": {
            "data": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "port",
                    "metro_area"
                  ]
                }
              }
            }
          }
        },
        "vessel": {
          "type": "object",
          "properties": {
            "data": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string",
                  "enum": [
                    "vessel"
                  ]
                }
              }
            }
          }
        },
        "terminal": {
          "type": "object",
          "properties": {
            "data": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "terminal",
                    "rail_terminal"
                  ]
                }
              }
            }
          }
        },
        "container": {
          "type": "object",
          "properties": {
            "data": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "container"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "required": [
    "id",
    "type"
  ]
}