{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://istointents.org/schemas/0.3/search-result.schema.json",
  "title": "Isto Intents search result",
  "description": "The structuredContent of intent_search_offers (MCP binding, search profile, draft 0.3). Offers link to the holder's own host; a result never carries a seller's contact.",
  "type": "object",
  "required": [
    "specVersion",
    "type",
    "offers",
    "suggestIntent"
  ],
  "properties": {
    "specVersion": {
      "const": "0.3"
    },
    "type": {
      "const": "search-result"
    },
    "offers": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "$ref": "#/$defs/offer"
      }
    },
    "totalMatches": {
      "type": "integer",
      "minimum": 0
    },
    "understood": {
      "type": "array",
      "maxItems": 30,
      "items": {
        "type": "string",
        "maxLength": 120
      }
    },
    "notUnderstood": {
      "type": "array",
      "maxItems": 30,
      "items": {
        "type": "string",
        "maxLength": 120
      }
    },
    "relaxed": {
      "type": "array",
      "maxItems": 30,
      "items": {
        "type": "string",
        "maxLength": 120
      }
    },
    "moreUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "description": "all results on the holder's host"
    },
    "suggestIntent": {
      "type": "boolean",
      "description": "true when the agent should offer an intent with the same holder (nothing or little found, or part of the statement dropped)"
    }
  },
  "$defs": {
    "offer": {
      "type": "object",
      "description": "one offer; a holder MAY add fields of its own",
      "required": [
        "url",
        "title"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "description": "the offer on the holder's host or below it"
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "price": {
          "type": "object",
          "required": [
            "amount",
            "currency"
          ],
          "properties": {
            "amount": {
              "type": "number",
              "minimum": 0
            },
            "currency": {
              "$ref": "https://istointents.org/schemas/0.1/common.schema.json#/$defs/currency"
            }
          },
          "additionalProperties": false
        },
        "year": {
          "type": "integer",
          "minimum": 1800,
          "maximum": 2200
        },
        "location": {
          "type": "string",
          "maxLength": 120
        },
        "photoUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "source": {
          "type": "string",
          "maxLength": 120,
          "description": "the site the holder took the offer from, as a name"
        }
      },
      "not": {
        "anyOf": [
          {
            "required": [
              "phone"
            ]
          },
          {
            "required": [
              "telephone"
            ]
          },
          {
            "required": [
              "email"
            ]
          },
          {
            "required": [
              "e-mail"
            ]
          },
          {
            "required": [
              "sellerName"
            ]
          },
          {
            "required": [
              "sellerPhone"
            ]
          },
          {
            "required": [
              "sellerEmail"
            ]
          },
          {
            "required": [
              "contact"
            ]
          },
          {
            "required": [
              "address"
            ]
          }
        ]
      }
    }
  }
}
