{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://matrixnetwork.me/source/audit/source-semantic-approval-snapshot-registry.schema.json",
  "title": "Y-Theory Source Semantic Approval Snapshot Registry",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "version",
    "status",
    "authority_boundary",
    "counts",
    "snapshot_pairs"
  ],
  "properties": {
    "schema": {
      "const": "y-theory.source-semantic-approval-snapshot-registry.v1"
    },
    "version": {
      "const": "SSRSNAP-2026.09.01.1"
    },
    "status": {
      "const": "append_only_hash_addressed_exact_registry_bytes"
    },
    "authority_boundary": {
      "type": "string",
      "minLength": 80
    },
    "counts": {
      "type": "object",
      "additionalProperties": false,
      "required": ["snapshot_pairs"],
      "properties": {
        "snapshot_pairs": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "snapshot_pairs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/snapshot_pair"
      }
    }
  },
  "$defs": {
    "sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "encoded_artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["schema", "encoding", "byte_length", "content_base64"],
      "properties": {
        "schema": {
          "type": "string",
          "minLength": 1
        },
        "encoding": {
          "const": "base64_exact_bytes"
        },
        "byte_length": {
          "type": "integer",
          "minimum": 1
        },
        "content_base64": {
          "type": "string",
          "minLength": 4,
          "pattern": "^[A-Za-z0-9+/]*={0,2}$"
        }
      }
    },
    "snapshot_pair": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "snapshot_id",
        "semantic_review_registry_sha256",
        "resolution_registry_sha256",
        "semantic_review_registry",
        "resolution_registry"
      ],
      "properties": {
        "snapshot_id": {
          "type": "string",
          "pattern": "^SSR-SNAPSHOT-[a-f0-9]{64}$"
        },
        "semantic_review_registry_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "resolution_registry_sha256": {
          "$ref": "#/$defs/sha256"
        },
        "semantic_review_registry": {
          "allOf": [
            { "$ref": "#/$defs/encoded_artifact" },
            {
              "properties": {
                "schema": {
                  "const": "y-theory.source-semantic-review-registry.v1"
                }
              }
            }
          ]
        },
        "resolution_registry": {
          "allOf": [
            { "$ref": "#/$defs/encoded_artifact" },
            {
              "properties": {
                "schema": {
                  "const": "y-theory.source-semantic-review-resolution-registry.v1"
                }
              }
            }
          ]
        }
      }
    }
  }
}
