{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/calculate-co-nz/json-schema/calculate-co-nz-find-calculator-response-schema.json",
  "title": "FindCalculatorResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/calculate-co-nz-discovery-api-openapi.yml#/components/schemas/FindCalculatorResponse",
  "properties": {
    "query": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Query",
      "description": "The query as searched."
    },
    "count": {
      "type": "integer",
      "title": "Count",
      "description": "Number of results returned, at most `limit`.",
      "default": 0
    },
    "results": {
      "items": {
        "$ref": "#/$defs/FindCalculatorHit"
      },
      "type": "array",
      "title": "Results",
      "description": "Matches, best first.",
      "default": []
    },
    "source": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source",
      "description": "Where the page index was loaded from."
    },
    "index_pages": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Index Pages",
      "description": "Pages in the index at the time of the search."
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error",
      "description": "Set only when the index could not be loaded. Results will be empty."
    }
  },
  "type": "object",
  "$defs": {
    "FindCalculatorHit": {
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Title",
          "description": "Page title."
        },
        "url": {
          "type": "string",
          "title": "Url",
          "description": "Full URL on calculate.co.nz."
        },
        "type": {
          "type": "string",
          "title": "Type",
          "description": "One of calculator, tool, guide or dataset."
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Category",
          "description": "Section of the site the page sits in."
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description",
          "description": "One line on what the page does."
        },
        "score": {
          "type": "number",
          "title": "Score",
          "description": "Relevance, higher is better. Comparable within one response only, not across different queries."
        }
      },
      "type": "object",
      "required": [
        "url",
        "type",
        "score"
      ],
      "title": "FindCalculatorHit"
    }
  }
}