{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hsimc.tech/rd/t736/ecosystem/schemas/vector-record.schema.json",
  "title": "Case reference: derived vector-index record",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "record_id",
    "observation_ref",
    "source_sha256",
    "chunk_ref",
    "embedding_space",
    "vector",
    "metadata"
  ],
  "properties": {
    "record_id": {
      "type": "string",
      "minLength": 1
    },
    "observation_ref": {
      "type": "string",
      "minLength": 1
    },
    "source_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "chunk_ref": {
      "type": "string",
      "minLength": 1
    },
    "embedding_space": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "model_id",
        "model_revision",
        "preprocessor_revision",
        "dimensions",
        "metric",
        "normalization",
        "modality"
      ],
      "properties": {
        "model_id": {
          "type": "string",
          "minLength": 1
        },
        "model_revision": {
          "type": "string",
          "minLength": 1
        },
        "preprocessor_revision": {
          "type": "string",
          "minLength": 1
        },
        "dimensions": {
          "type": "integer",
          "minimum": 1
        },
        "metric": {
          "enum": [
            "cosine",
            "dot",
            "euclidean"
          ]
        },
        "normalization": {
          "type": "string",
          "minLength": 1
        },
        "modality": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "vector": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "number"
      }
    },
    "metadata": {
      "type": "object",
      "required": [
        "tenant_ref",
        "scope_ref",
        "source_kind",
        "valid_until",
        "index_revision"
      ],
      "properties": {
        "tenant_ref": {
          "type": "string",
          "minLength": 1
        },
        "scope_ref": {
          "type": "string",
          "minLength": 1
        },
        "source_kind": {
          "enum": [
            "SIMULATED",
            "REPLAY",
            "PHYSICAL",
            "HUMAN_STUDY"
          ]
        },
        "valid_until": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "index_revision": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  },
  "$comment": "Implementation MUST additionally verify vector length equals dimensions, numeric finiteness, embedding-space identity, access policy and source/freshness. This schema does not generate or validate semantic embeddings."
}
