{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tryorcha-com/json-schema/tryorcha-com-search-response-schema.json",
  "title": "SearchResponse",
  "description": "`results` is cited evidence; `coverage` carries routing notes (live fetches, unfetched catalog matches, budget limits) and must never be quoted as content.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tryorcha-com-openapi.json#/components/schemas/SearchResponse",
  "type": "object",
  "properties": {
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "chunkId": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "fileId": {
            "type": [
              "string",
              "null"
            ]
          },
          "score": {
            "type": "number"
          },
          "content": {
            "type": "string"
          },
          "startLine": {
            "type": "integer"
          },
          "endLine": {
            "type": "integer"
          },
          "headingPath": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "citation": {
            "$ref": "#/$defs/Citation"
          }
        },
        "additionalProperties": true
      }
    },
    "coverage": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "mode": {
      "type": "string",
      "enum": [
        "fast",
        "balanced",
        "fresh"
      ]
    }
  },
  "additionalProperties": true,
  "$defs": {
    "Citation": {
      "type": "object",
      "description": "Provenance for externally sourced content",
      "required": [
        "provider",
        "objectId",
        "deepLink"
      ],
      "properties": {
        "provider": {
          "type": "string"
        },
        "objectId": {
          "type": "string"
        },
        "deepLink": {
          "type": "string",
          "format": "uri"
        },
        "title": {
          "type": "string"
        },
        "author": {
          "type": "string"
        },
        "location": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
  }
}