{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hayalows.com/webmcp/results.schema.json",
  "title": "Hayalows WebMCP result contracts",
  "description": "Versioned result contracts for the WebMCP tools exposed by hayalows.com. Each contract is also registered as outputSchema and every object result is returned as structuredContent.",
  "oneOf": [
    { "$ref": "#/$defs/AskHayalowsResult" },
    { "$ref": "#/$defs/BrowseHayalowsServicesResult" },
    { "$ref": "#/$defs/PrepareHayalowsEnquiryResult" },
    { "$ref": "#/$defs/NavigateHayalowsResult" }
  ],
  "$defs": {
    "PublishedSection": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "title": { "type": "string" },
        "text": { "type": "string" },
        "tags": { "type": "array", "items": { "type": "string" } },
        "url": { "type": "string", "format": "uri" }
      },
      "required": ["id", "title", "text", "tags", "url"],
      "additionalProperties": false
    },
    "AskHayalowsResult": {
      "type": "object",
      "properties": {
        "schemaVersion": { "const": "1.1.0" },
        "schemaUrl": { "const": "https://hayalows.com/webmcp/results.schema.json" },
        "query": { "type": "string" },
        "matches": { "type": "array", "maxItems": 4, "items": { "$ref": "#/$defs/PublishedSection" } },
        "note": { "type": "string" },
        "contact": {
          "oneOf": [
            { "type": "null" },
            {
              "type": "object",
              "properties": {
                "url": { "type": "string", "format": "uri" },
                "email": { "type": "string", "format": "email" }
              },
              "required": ["url", "email"],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": ["schemaVersion", "schemaUrl", "query", "matches", "note", "contact"],
      "additionalProperties": false
    },
    "Offering": {
      "type": "object",
      "properties": {
        "key": { "enum": ["business_clarity", "brand_communication", "websites_tools"] },
        "name": { "type": "string" },
        "bestFor": { "type": "string" }
      },
      "required": ["key", "name", "bestFor"],
      "additionalProperties": false
    },
    "BrowseHayalowsServicesResult": {
      "type": "object",
      "properties": {
        "schemaVersion": { "const": "1.1.0" },
        "schemaUrl": { "const": "https://hayalows.com/webmcp/results.schema.json" },
        "offerings": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "$ref": "#/$defs/Offering" } },
        "selected": { "enum": ["all", "business_clarity", "brand_communication", "websites_tools"] },
        "sourceUrl": { "const": "https://hayalows.com/#what-we-do" },
        "pageEffect": { "type": "string" },
        "navigationStarted": { "type": "boolean" }
      },
      "required": ["schemaVersion", "schemaUrl", "offerings", "selected", "sourceUrl", "pageEffect", "navigationStarted"],
      "additionalProperties": false
    },
    "PrepareHayalowsEnquiryResult": {
      "type": "object",
      "properties": {
        "schemaVersion": { "const": "1.1.0" },
        "schemaUrl": { "const": "https://hayalows.com/webmcp/results.schema.json" },
        "status": { "enum": ["draft_saved", "draft_ready"] },
        "helpType": { "enum": ["Business clarity or systems", "Brand and communication", "Website or digital tool", "Product or venture discussion", "Partnership", "General enquiry"] },
        "message": { "type": "string" },
        "contactDetailsIncluded": { "type": "boolean" },
        "sent": { "const": false },
        "navigationStarted": { "type": "boolean" },
        "nextStep": { "type": "string" },
        "sourceUrl": { "const": "https://hayalows.com/#contact-form" }
      },
      "required": ["schemaVersion", "schemaUrl", "status", "helpType", "message", "contactDetailsIncluded", "sent", "navigationStarted", "nextStep", "sourceUrl"],
      "additionalProperties": false
    },
    "NavigateHayalowsResult": {
      "type": "object",
      "properties": {
        "schemaVersion": { "const": "1.1.0" },
        "schemaUrl": { "const": "https://hayalows.com/webmcp/results.schema.json" },
        "destination": { "enum": ["home", "services", "approach", "enquiry", "payments", "payments_refunds", "privacy", "terms"] },
        "label": { "type": "string" },
        "url": { "type": "string", "format": "uri" },
        "navigationStarted": { "const": true },
        "nextStep": { "type": "string" }
      },
      "required": ["schemaVersion", "schemaUrl", "destination", "label", "url", "navigationStarted", "nextStep"],
      "additionalProperties": false
    }
  }
}
