{
  "type": "object",
  "title": "Shipment",
  "description": "A Shipment represents the movement of one or more packages from an origin to a destination. It is the top-level fulfillment entity in a logistics transaction and maps to beckn:Fulfillment. ",
  "required": [
    "id",
    "status",
    "origin",
    "destination"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the shipment",
      "example": "SHP-2024-001234"
    },
    "trackingId": {
      "type": "string",
      "description": "Public tracking identifier shared with sender/receiver",
      "example": "TRK9876543210IN"
    },
    "status": {
      "type": "string",
      "description": "Current status of the shipment",
      "enum": [
        "CREATED",
        "PICKUP_PENDING",
        "PICKED_UP",
        "IN_TRANSIT",
        "AT_HUB",
        "OUT_FOR_DELIVERY",
        "DELIVERED",
        "FAILED_DELIVERY",
        "RETURNED",
        "CANCELLED"
      ],
      "example": "IN_TRANSIT"
    },
    "origin": {
      "$ref": "https://schema.nfh.global/LogisticsPlace/v2.0/schema.json"
    },
    "destination": {
      "$ref": "https://schema.nfh.global/LogisticsPlace/v2.0/schema.json"
    },
    "packages": {
      "type": "array",
      "description": "List of packages in this shipment",
      "items": {
        "$ref": "https://schema.nfh.global/Package/v2.0/schema.json"
      }
    },
    "carrier": {
      "$ref": "https://schema.nfh.global/Carrier/v2.0/schema.json"
    },
    "driver": {
      "$ref": "https://schema.nfh.global/Driver/v2.0/schema.json"
    },
    "vehicle": {
      "$ref": "https://schema.nfh.global/Vehicle/v2.0/schema.json"
    },
    "route": {
      "$ref": "https://schema.nfh.global/Route/v2.0/schema.json"
    },
    "scheduledPickup": {
      "type": "string",
      "format": "date-time",
      "description": "Scheduled pickup time"
    },
    "estimatedDelivery": {
      "type": "string",
      "format": "date-time",
      "description": "Estimated delivery date and time"
    },
    "actualDelivery": {
      "type": "string",
      "format": "date-time",
      "description": "Actual delivery date and time"
    },
    "deliverySlot": {
      "$ref": "https://schema.nfh.global/DeliverySlot/v2.0/schema.json"
    },
    "serviceType": {
      "type": "string",
      "description": "Type of logistics service",
      "enum": [
        "HYPERLOCAL",
        "COURIER",
        "INTERSTATE",
        "LONG_HAUL",
        "EXPRESS"
      ],
      "example": "EXPRESS"
    },
    "specialInstructions": {
      "type": "string",
      "description": "Special handling instructions for the shipment",
      "example": "Handle with care. Do not tilt."
    },
    "proof": {
      "$ref": "https://schema.nfh.global/Proof/v2.0/schema.json"
    },
    "fare": {
      "$ref": "https://schema.nfh.global/Fare/v2.0/schema.json"
    },
    "receipt": {
      "$ref": "https://schema.nfh.global/LogisticsReceipt/v2.0/schema.json"
    },
    "cancellationPolicy": {
      "$ref": "https://schema.nfh.global/CancellationPolicy/v2.0/schema.json"
    },
    "returnPolicy": {
      "$ref": "https://schema.nfh.global/ReturnPolicy/v2.0/schema.json"
    },
    "alerts": {
      "type": "array",
      "description": "Alerts raised for this shipment",
      "items": {
        "$ref": "https://schema.nfh.global/Alert/v2.0/schema.json"
      }
    },
    "trackingUpdates": {
      "type": "array",
      "description": "History of tracking updates",
      "items": {
        "$ref": "https://schema.nfh.global/TrackingUpdate/v2.0/schema.json"
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when shipment was created"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp of last update"
    }
  },
  "$id": "https://schema.nfh.global/Shipment/v2.0",
  "x-iri": "https://schema.nfh.global/Shipment/v2.0",
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}
