{
  "$id": "https://commandlayer.org/schemas/v1.1.0/commercial/ship/receipts/ship.receipt.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ship.receipt",
  "description": "Receipt schema for shipment / fulfillment events.",
  "allOf": [
    {
      "$ref": "https://commandlayer.org/schemas/v1.1.0/_shared/receipt.base.schema.json"
    },
    {
      "type": "object",
      "properties": {
        "result": {
          "description": "Shipment outcome payload.",
          "type": "object",
          "additionalProperties": false,
          "required": ["shipment_id", "status"],
          "properties": {
            "shipment_id": {
              "description": "Canonical shipment identifier.",
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "order_id": {
              "description": "Order ID this shipment is associated with.",
              "type": "string",
              "maxLength": 128
            },
            "status": {
              "description": "Shipment status.",
              "type": "string",
              "enum": ["label_created", "in_transit", "delivered", "failed", "returned"]
            },
            "carrier": {
              "description": "Shipping carrier.",
              "type": "string",
              "maxLength": 64
            },
            "tracking_number": {
              "description": "Tracking number or link reference.",
              "type": "string",
              "maxLength": 256
            },
            "eta": {
              "description": "Estimated time of arrival.",
              "type": "string",
              "format": "date-time",
              "maxLength": 64
            },
            "metadata": {
              "description": "Optional provider- or runtime-specific additional context.",
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "usage": {
          "description": "Optional resource usage metrics (tokens, compute units, etc.).",
          "type": "object",
          "additionalProperties": true
        }
      },
      "required": ["result"]
    }
  ]
}
