{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.vik.guru/a3-stacked-cube-atlas-expanded/0.2/expanded-delta.schema.json",
  "title": "A3 stacked-cube Atlas expansion delta",
  "description": "Research-derived semantic planes that extend, but do not overwrite, the protected v0.1 authority model.",
  "type": "object",
  "required": [
    "schema_version",
    "as_of",
    "artifact_id",
    "extends",
    "method",
    "protected_semantics",
    "scope_statement",
    "lenses",
    "assurance_gates",
    "migration_gates",
    "runtime_semantics",
    "evidence_classes",
    "discrepancy_register",
    "design_decisions"
  ],
  "properties": {
    "schema_version": { "const": "0.2.0" },
    "as_of": { "type": "string", "format": "date" },
    "artifact_id": { "const": "A3-CUBE-EXPANDED" },
    "extends": {
      "type": "object",
      "required": ["artifact_id", "version", "local_source", "preserve_stable_ids"],
      "properties": {
        "artifact_id": { "type": "string", "minLength": 1 },
        "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
        "local_source": { "type": "string", "minLength": 1 },
        "preserve_stable_ids": { "const": true }
      },
      "additionalProperties": false
    },
    "method": {
      "type": "object",
      "required": ["name", "version", "source", "claim_evidence_pair", "probability_referent"],
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "version": { "type": "string", "minLength": 1 },
        "source": {
          "type": "string",
          "format": "uri",
          "description": "Public source URI or stable source-key URN."
        },
        "claim_evidence_pair": { "type": "string", "minLength": 1 },
        "probability_referent": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "protected_semantics": { "$ref": "#/$defs/nonEmptyStrings" },
    "scope_statement": {
      "type": "object",
      "required": [
        "system",
        "intended_use",
        "jurisdiction",
        "device_or_non_device_status",
        "part_11_applicability",
        "hipaa_applicability",
        "clia_applicability",
        "nih_controlled_access_applicability",
        "warning"
      ],
      "additionalProperties": { "type": "string" }
    },
    "lenses": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "object",
        "required": ["id", "label", "question"],
        "properties": {
          "id": { "$ref": "#/$defs/id" },
          "label": { "$ref": "#/$defs/text" },
          "question": { "$ref": "#/$defs/text" }
        },
        "additionalProperties": false
      }
    },
    "assurance_gates": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "label", "status", "checks", "human_authority", "falsifier", "source_ids"],
        "properties": {
          "id": { "type": "string", "pattern": "^AG-\\d{2}$" },
          "label": { "$ref": "#/$defs/text" },
          "status": { "$ref": "#/$defs/text" },
          "checks": { "$ref": "#/$defs/nonEmptyStrings" },
          "human_authority": { "$ref": "#/$defs/text" },
          "falsifier": { "$ref": "#/$defs/text" },
          "source_ids": { "$ref": "#/$defs/sourceRefs" }
        },
        "additionalProperties": false
      }
    },
    "migration_gates": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "label", "status", "requires"],
        "properties": {
          "id": { "type": "string", "pattern": "^G\\d+$" },
          "label": { "$ref": "#/$defs/text" },
          "status": { "$ref": "#/$defs/text" },
          "requires": { "$ref": "#/$defs/nonEmptyStrings" }
        },
        "additionalProperties": false
      }
    },
    "runtime_semantics": {
      "type": "object",
      "required": ["authority_dimensions", "candidate_elements", "typed_connectors", "guardrails"],
      "properties": {
        "authority_dimensions": { "$ref": "#/$defs/nonEmptyStrings" },
        "candidate_elements": { "$ref": "#/$defs/nonEmptyStrings" },
        "typed_connectors": { "$ref": "#/$defs/nonEmptyStrings" },
        "guardrails": { "$ref": "#/$defs/nonEmptyStrings" }
      },
      "additionalProperties": false
    },
    "evidence_classes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "label", "visual"],
        "properties": {
          "id": { "$ref": "#/$defs/id" },
          "label": { "$ref": "#/$defs/text" },
          "visual": { "$ref": "#/$defs/text" }
        },
        "additionalProperties": false
      }
    },
    "discrepancy_register": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "question", "confidence", "basis", "distribution", "falsifier"],
        "properties": {
          "id": { "type": "string", "pattern": "^DR-\\d{2}$" },
          "question": { "$ref": "#/$defs/text" },
          "confidence": { "$ref": "#/$defs/text" },
          "basis": { "$ref": "#/$defs/text" },
          "falsifier": { "$ref": "#/$defs/text" },
          "distribution": {
            "type": "object",
            "required": [
              "H1_real_omitted_boundary_or_control",
              "H2_real_behavior_unstable_boundary",
              "H3_stale_or_contextual_evidence",
              "H_benign_no_new_object_needed"
            ],
            "properties": {
              "H1_real_omitted_boundary_or_control": { "$ref": "#/$defs/percentage" },
              "H2_real_behavior_unstable_boundary": { "$ref": "#/$defs/percentage" },
              "H3_stale_or_contextual_evidence": { "$ref": "#/$defs/percentage" },
              "H_benign_no_new_object_needed": { "$ref": "#/$defs/percentage" }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    },
    "design_decisions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "decision", "evidence_state", "reason"],
        "properties": {
          "id": { "type": "string", "pattern": "^DD-\\d{2}$" },
          "decision": { "$ref": "#/$defs/text" },
          "evidence_state": { "$ref": "#/$defs/text" },
          "reason": { "$ref": "#/$defs/text" }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "text": { "type": "string", "minLength": 1 },
    "id": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]*$" },
    "percentage": { "type": "integer", "minimum": 0, "maximum": 100 },
    "sourceRef": { "type": "string", "pattern": "^SRC-[A-Z0-9]+(?:-[A-Z0-9]+)*$" },
    "sourceRefs": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": { "$ref": "#/$defs/sourceRef" }
    },
    "nonEmptyStrings": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": { "$ref": "#/$defs/text" }
    }
  }
}
