{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vertesiahq/json-schema/vertesiahq-object-search-response-schema.json",
  "title": "ObjectSearchResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vertesiahq-collections-api-openapi.yml#/components/schemas/ObjectSearchResponse",
  "type": "object",
  "properties": {
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProjectedContentObjectApiResponse"
      }
    },
    "facets": {
      "$ref": "#/$defs/ComputedFacetResponse"
    },
    "aggregations": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "required": [
    "results",
    "facets"
  ],
  "additionalProperties": false,
  "$defs": {
    "ComputedFacetResponse": {
      "type": "object",
      "properties": {
        "total": {
          "type": "number"
        }
      },
      "additionalProperties": {
        "type": [
          "array",
          "number"
        ]
      }
    },
    "ContentObjectApiRevision": {
      "type": "object",
      "properties": {
        "parent": {
          "type": "string"
        },
        "root": {
          "type": "string"
        },
        "head": {
          "type": "boolean"
        },
        "label": {
          "type": "string"
        }
      },
      "required": [
        "root",
        "head"
      ],
      "additionalProperties": false
    },
    "ContentObjectApiTypeRef": {
      "$ref": "#/$defs/ContentObjectTypeRef"
    },
    "ContentObjectStatus": {
      "type": "string",
      "enum": [
        "created",
        "processing",
        "ready",
        "completed",
        "failed",
        "archived"
      ]
    },
    "ContentObjectTypeRef": {
      "oneOf": [
        {
          "$ref": "#/$defs/StoredTypeRef"
        },
        {
          "$ref": "#/$defs/InCodeTypeRef"
        }
      ],
      "type": "object",
      "required": [
        "ref_type"
      ]
    },
    "ContentObjectUserPermissions": {
      "type": "object",
      "properties": {
        "can_write": {
          "type": "boolean"
        },
        "can_delete": {
          "type": "boolean"
        }
      },
      "required": [
        "can_write",
        "can_delete"
      ],
      "additionalProperties": false,
      "description": "Computed per-request permissions for the current user on a content object. Not stored in the database — computed on the fly by the API from the object's security field."
    },
    "ContentSource": {
      "type": "object",
      "properties": {
        "source": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "etag": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Embedding": {
      "type": "object",
      "properties": {
        "model": {
          "type": "string"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "number"
          }
        },
        "etag": {
          "type": "string"
        }
      },
      "required": [
        "model",
        "values"
      ],
      "additionalProperties": false
    },
    "EmbeddingMap": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/Embedding"
      }
    },
    "InCodeTypeRef": {
      "type": "object",
      "properties": {
        "ref_type": {
          "type": "string",
          "const": "incode"
        },
        "id": {
          "type": "string",
          "description": "Namespaced identifier for in-code types (e.g. \"sys:Invoice\", \"app:myapp:Contract\")"
        },
        "name": {
          "type": "string"
        },
        "default_view": {
          "type": "string",
          "enum": [
            "auto",
            "text",
            "pdf",
            "image",
            "properties"
          ],
          "description": "Display hint from the type's intake policy (`intake.default_view`). Enriched by the API on single-object reads so clients can pick the initial view without fetching the type. Absent on list responses and older servers."
        }
      },
      "required": [
        "ref_type",
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "InheritedPropertyMetadata": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The property name that was inherited"
        },
        "collection": {
          "type": "string",
          "description": "The collection ID that provided this property"
        }
      },
      "required": [
        "name",
        "collection"
      ],
      "additionalProperties": false,
      "description": "Metadata about a single inherited property."
    },
    "JSONObject": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/JSONValue"
      }
    },
    "JSONValue": {},
    "ProjectedContentObjectApiResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier for the object"
        },
        "name": {
          "type": "string",
          "description": "Human-readable name or title"
        },
        "description": {
          "type": "string",
          "description": "Optional detailed description of the object"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Optional array of categorization tags"
        },
        "updated_by": {
          "type": "string",
          "description": "Identifier of the user who last modified the object"
        },
        "created_by": {
          "type": "string",
          "description": "Identifier of the user who created the object"
        },
        "created_at": {
          "type": "string",
          "description": "ISO timestamp of when the object was created"
        },
        "updated_at": {
          "type": "string",
          "description": "ISO timestamp of when the object was last updated"
        },
        "parent": {
          "type": "string"
        },
        "location": {
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/ContentObjectStatus"
        },
        "type": {
          "$ref": "#/$defs/ContentObjectApiTypeRef"
        },
        "content": {
          "$ref": "#/$defs/ContentSource"
        },
        "external_id": {
          "type": "string"
        },
        "properties": {
          "$ref": "#/$defs/JSONObject"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true
        },
        "tokens": {
          "type": "object",
          "properties": {
            "count": {
              "type": "number"
            },
            "encoding": {
              "type": "string"
            },
            "etag": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "revision": {
          "$ref": "#/$defs/ContentObjectApiRevision"
        },
        "is_deleted": {
          "type": "boolean"
        },
        "is_locked": {
          "type": "boolean"
        },
        "score": {
          "type": "number"
        },
        "user_permissions": {
          "$ref": "#/$defs/ContentObjectUserPermissions"
        },
        "searchTypeResult": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "score": {
                "type": "number"
              },
              "rank": {
                "type": "number"
              }
            },
            "required": [
              "type",
              "score",
              "rank"
            ],
            "additionalProperties": false
          }
        },
        "text": {
          "type": "string"
        },
        "text_etag": {
          "type": "string"
        },
        "embeddings": {
          "$ref": "#/$defs/EmbeddingMap"
        },
        "parts": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "parts_etag": {
          "type": "string"
        },
        "transcript": {
          "type": "object",
          "additionalProperties": true
        },
        "security": {
          "$ref": "#/$defs/StringArrayMap"
        },
        "sensitivity": {
          "anyOf": [
            {
              "type": "number",
              "description": "BLP sensitivity level — set directly or inherited from collections (max across collections)."
            },
            {
              "type": "null"
            }
          ]
        },
        "compartments": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Compartments — set directly or inherited from collections (union across collections)."
        },
        "shared": {
          "type": "boolean",
          "description": "Effective shared state: true iff the document is a member of an effectively-shared collection (inherited; sync-managed). Combine with shared_root for full readability."
        },
        "shared_root": {
          "type": "boolean",
          "description": "True iff the document was explicitly shared via the API (a root of the project shared space). Never set by the sync."
        },
        "inherited_properties": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InheritedPropertyMetadata"
          }
        }
      },
      "additionalProperties": false
    },
    "StoredTypeRef": {
      "type": "object",
      "properties": {
        "ref_type": {
          "type": "string",
          "const": "stored"
        },
        "id": {
          "type": "string",
          "description": "MongoDB ObjectId string for stored types"
        },
        "name": {
          "type": "string"
        },
        "default_view": {
          "type": "string",
          "enum": [
            "auto",
            "text",
            "pdf",
            "image",
            "properties"
          ],
          "description": "Display hint from the type's intake policy (`intake.default_view`). Enriched by the API on single-object reads so clients can pick the initial view without fetching the type. Absent on list responses and older servers."
        }
      },
      "required": [
        "ref_type",
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "StringArrayMap": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    }
  }
}