{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/andrewhuot/headless-chat-sdk/schemas/rich-content.schema.json",
  "title": "Rich content payloads and per-family capability descriptors",
  "description": "Schemas for the SDK's built-in rich content families plus the negotiation surface (PartFamilyCapability, ClientCapabilityDoc, ServerCapabilityDoc). Mirrors packages/gecx-chat/src/rich-content/*.",
  "definitions": {
    "ProductCarousel": {
      "type": "object",
      "required": ["products"],
      "properties": {
        "products": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["id", "title"],
            "properties": {
              "id": { "type": "string" },
              "title": { "type": "string" },
              "description": { "type": "string" },
              "imageUrl": { "type": "string", "format": "uri" },
              "price": { "type": "string" },
              "currency": { "type": "string" },
              "url": { "type": "string", "format": "uri" }
            }
          }
        }
      }
    },
    "OrderSummary": {
      "type": "object",
      "required": ["orderId", "items", "subtotal", "total"],
      "properties": {
        "orderId": { "type": "string" },
        "items": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["name", "quantity", "price"],
            "properties": {
              "name": { "type": "string" },
              "quantity": { "type": "integer", "minimum": 1 },
              "price": { "type": "string" },
              "imageUrl": { "type": "string", "format": "uri" }
            }
          }
        },
        "subtotal": { "type": "string" },
        "tax": { "type": "string" },
        "shipping": { "type": "string" },
        "total": { "type": "string" },
        "currency": { "type": "string" },
        "status": { "type": "string" }
      }
    },
    "Citation": {
      "type": "object",
      "required": ["title", "url"],
      "properties": {
        "title": { "type": "string" },
        "url": { "type": "string", "format": "uri" },
        "snippet": { "type": "string" }
      }
    },
    "SuggestionChips": {
      "type": "object",
      "required": ["chips"],
      "properties": {
        "chips": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["label"],
            "properties": { "label": { "type": "string" }, "value": { "type": "string" } }
          }
        }
      }
    },
    "PartFamilyCapability": {
      "type": "object",
      "required": ["versions", "fallback"],
      "properties": {
        "versions": {
          "type": "array",
          "items": { "type": "integer", "minimum": 1 }
        },
        "fallback": { "type": "string", "enum": ["text", "hide"] },
        "source": { "type": "string", "enum": ["core", "standard", "custom"] }
      }
    },
    "PartCapabilities": {
      "type": "object",
      "additionalProperties": { "$ref": "#/definitions/PartFamilyCapability" }
    },
    "ClientCapabilityDoc": {
      "type": "object",
      "required": ["schemaVersion", "families"],
      "properties": {
        "schemaVersion": { "const": 1 },
        "families": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["family", "versions", "fallback"],
            "properties": {
              "family": { "type": "string" },
              "versions": {
                "type": "array",
                "items": { "type": "integer", "minimum": 1 }
              },
              "fallback": { "type": "string", "enum": ["text", "hide"] }
            }
          }
        }
      }
    },
    "ServerCapabilityDoc": {
      "type": "object",
      "properties": {
        "schemaVersion": { "type": "integer", "minimum": 1 },
        "acceptedFamilies": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["family", "versions"],
            "properties": {
              "family": { "type": "string" },
              "versions": {
                "type": "array",
                "items": { "type": "integer", "minimum": 1 }
              }
            }
          }
        }
      }
    },
    "RichPayloadEnvelope": {
      "type": "object",
      "required": ["payloadType", "data"],
      "properties": {
        "payloadType": { "type": "string" },
        "payloadVersion": { "type": "integer", "minimum": 1 },
        "data": { "type": "object" }
      }
    }
  }
}
