{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/fabric-com/refs/heads/main/json-schema/fabric-order-schema.json",
  "title": "fabric Order",
  "description": "Order representation owned by fabric OMS and produced by the Checkout API.",
  "type": "object",
  "required": ["orderId", "orderNumber", "status"],
  "properties": {
    "orderId": {"type": "string", "description": "fabric internal order identifier."},
    "orderNumber": {"type": "string", "description": "Merchant-facing order number."},
    "status": {"type": "string", "enum": ["CREATED", "AUTHORIZED", "RELEASED", "ALLOCATED", "PICKED", "PACKED", "SHIPPED", "DELIVERED", "CANCELLED", "RETURNED"]},
    "customerId": {"type": "string"},
    "currency": {"type": "string", "pattern": "^[A-Z]{3}$"},
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["sku", "quantity"],
        "properties": {
          "sku": {"type": "string"},
          "quantity": {"type": "integer", "minimum": 1},
          "unitPrice": {"type": "number"},
          "lineTotal": {"type": "number"}
        }
      }
    },
    "shipTo": {"type": "object"},
    "billTo": {"type": "object"},
    "payments": {"type": "array", "items": {"type": "object"}},
    "shipments": {"type": "array", "items": {"type": "object"}},
    "invoices": {"type": "array", "items": {"type": "object"}},
    "totals": {"type": "object"},
    "createdAt": {"type": "string", "format": "date-time"},
    "updatedAt": {"type": "string", "format": "date-time"}
  },
  "additionalProperties": true
}
