{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rossdata-dev/json-schema/rossdata-dev-unified-search-result-schema.json",
  "title": "UnifiedSearchResult",
  "description": "Cross-domain search hits across all four layers. Each array is capped at `limit` (per domain).",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rossdata-dev-openapi.json#/components/schemas/UnifiedSearchResult",
  "type": "object",
  "properties": {
    "query": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "all",
        "object",
        "column",
        "facility",
        "program"
      ]
    },
    "counts": {
      "type": "object",
      "properties": {
        "objects": {
          "type": "integer"
        },
        "columns": {
          "type": "integer"
        },
        "facilities": {
          "type": "integer"
        },
        "programs": {
          "type": "integer"
        },
        "total": {
          "type": "integer"
        }
      }
    },
    "objects": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ObjectSummary"
      }
    },
    "columns": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "facilities": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FacilitySummary"
      }
    },
    "programs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProgramSummary"
      }
    },
    "note": {
      "type": "string"
    }
  },
  "$defs": {
    "FacilitySummary": {
      "type": "object",
      "properties": {
        "facility": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "system": {
          "type": "string"
        },
        "database": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "FIN",
            "MAN"
          ]
        },
        "class": {
          "type": [
            "string",
            "null"
          ]
        },
        "program": {
          "type": [
            "string",
            "null"
          ]
        },
        "coreTables": {
          "type": "integer",
          "description": "Count of core working-set tables"
        },
        "referenceTables": {
          "type": "integer",
          "description": "Count of reference/lookup tables"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "ObjectSummary": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "table",
            "view",
            "procedure",
            "function"
          ]
        },
        "database": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "FIN",
            "MAN"
          ]
        },
        "module": {
          "type": [
            "string",
            "null"
          ]
        },
        "class": {
          "type": [
            "string",
            "null"
          ],
          "description": "e.g. 'ref' for a lookup table"
        },
        "columns": {
          "type": "integer"
        },
        "hasPrimaryKey": {
          "type": "boolean"
        },
        "usedByPrograms": {
          "type": "integer"
        },
        "usedByViewsProcs": {
          "type": "integer"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "ProgramSummary": {
      "type": "object",
      "properties": {
        "basename": {
          "type": "string"
        },
        "programId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Declared TITLE id; null for internal programs"
        },
        "title": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Display name — the TITLE label, or the registry description of a menu facility it backs for untitled programs"
        },
        "module": {
          "type": "string"
        },
        "moduleName": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": [
            "string",
            "null"
          ],
          "description": "Program-type letter"
        },
        "typeName": {
          "type": [
            "string",
            "null"
          ]
        },
        "layer": {
          "type": "string",
          "enum": [
            "base",
            "vendor-core"
          ]
        },
        "tableCount": {
          "type": "integer",
          "description": "Data Dictionary tables referenced"
        },
        "writeCount": {
          "type": "integer",
          "description": "Of the referenced tables, how many the program writes to (FIND IN.../LOCK=WRITE, ADD, or DELETE)"
        },
        "procedureCount": {
          "type": "integer",
          "description": "PROCEDURE_FORM blocks"
        },
        "callsCount": {
          "type": "integer",
          "description": "Programs this one invokes (outbound call edges)"
        },
        "calledByCount": {
          "type": "integer",
          "description": "Programs that invoke this one"
        },
        "menuCount": {
          "type": "integer",
          "description": "Menu facilities this program backs"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}