{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ctlsurf-com/json-schema/ctlsurf-com-unified-search-response-schema.json",
  "title": "UnifiedSearchResponse",
  "description": "Combined search results from pages and blocks.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ctlsurf-com-search-api-openapi.yml#/components/schemas/UnifiedSearchResponse",
  "properties": {
    "query": {
      "type": "string",
      "title": "Query"
    },
    "pages": {
      "items": {
        "$ref": "#/$defs/UnifiedPageResult"
      },
      "type": "array",
      "title": "Pages"
    },
    "blocks": {
      "items": {
        "$ref": "#/$defs/UnifiedBlockResult"
      },
      "type": "array",
      "title": "Blocks"
    },
    "total_pages": {
      "type": "integer",
      "title": "Total Pages"
    },
    "total_blocks": {
      "type": "integer",
      "title": "Total Blocks"
    },
    "limit": {
      "type": "integer",
      "title": "Limit"
    },
    "offset": {
      "type": "integer",
      "title": "Offset"
    }
  },
  "type": "object",
  "required": [
    "query",
    "pages",
    "blocks",
    "total_pages",
    "total_blocks",
    "limit",
    "offset"
  ],
  "$defs": {
    "BlockType": {
      "type": "string",
      "enum": [
        "text",
        "checklist",
        "table",
        "react_flow",
        "agent_control",
        "tree",
        "ctlsurf_task",
        "page_summary",
        "file",
        "mindmap",
        "datastore",
        "state",
        "log",
        "presentation"
      ],
      "title": "BlockType"
    },
    "UnifiedBlockResult": {
      "properties": {
        "result_type": {
          "type": "string",
          "const": "block",
          "title": "Result Type",
          "default": "block"
        },
        "block_id": {
          "type": "string",
          "format": "uuid",
          "title": "Block Id"
        },
        "page_id": {
          "type": "string",
          "format": "uuid",
          "title": "Page Id"
        },
        "page_title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Page Title"
        },
        "block_title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Block Title"
        },
        "block_type": {
          "$ref": "#/$defs/BlockType"
        },
        "snippet": {
          "type": "string",
          "title": "Snippet"
        },
        "match_start": {
          "type": "integer",
          "title": "Match Start"
        },
        "match_end": {
          "type": "integer",
          "title": "Match End"
        },
        "size_bytes": {
          "type": "integer",
          "title": "Size Bytes"
        },
        "content_type": {
          "type": "string",
          "title": "Content Type"
        },
        "rank": {
          "type": "number",
          "title": "Rank"
        }
      },
      "type": "object",
      "required": [
        "block_id",
        "page_id",
        "page_title",
        "block_title",
        "block_type",
        "snippet",
        "match_start",
        "match_end",
        "size_bytes",
        "content_type",
        "rank"
      ],
      "title": "UnifiedBlockResult",
      "description": "Block match in unified search."
    },
    "UnifiedPageResult": {
      "properties": {
        "result_type": {
          "type": "string",
          "const": "page",
          "title": "Result Type",
          "default": "page"
        },
        "page_id": {
          "type": "string",
          "format": "uuid",
          "title": "Page Id"
        },
        "page_title": {
          "type": "string",
          "title": "Page Title"
        },
        "root_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Root Path"
        },
        "folder_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Folder Id"
        },
        "rank": {
          "type": "number",
          "title": "Rank"
        },
        "match_type": {
          "type": "string",
          "title": "Match Type"
        }
      },
      "type": "object",
      "required": [
        "page_id",
        "page_title",
        "rank",
        "match_type"
      ],
      "title": "UnifiedPageResult",
      "description": "Page match in unified search."
    }
  }
}