{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://metryval.com/data/policy-decisions-ledger.schema.json",
  "title": "Metryval Policy Decisions Ledger v1",
  "description": "Per-decision load-bearing use-case scope, product boundaries, and structural refusals for Metryval. Canonical source of truth lives in metryval-3d/docs/policy_decisions_ledger_v1.md; this schema governs the JSON projection served at /data/policy-decisions-ledger.json. Companion ledger to framework-reception-ledger.json.",
  "type": "object",
  "required": ["schema_version", "ledger_version", "last_updated", "entries", "candidate_entries", "version_history"],
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0.0"
    },
    "ledger_version": {
      "type": "string",
      "pattern": "^v\\d+(\\.\\d+)*$"
    },
    "last_updated": {
      "type": "string",
      "format": "date"
    },
    "source_of_truth": {
      "type": "string"
    },
    "public_surface": {
      "type": "string"
    },
    "entries": {
      "type": "array",
      "description": "Formalized policy decision entries. Each entry binds across all surfaces listed in scope and remains in force until status changes.",
      "items": {
        "type": "object",
        "required": ["id", "title", "status", "date_locked", "decision_summary", "rationale_layers", "review_conditions"],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^P-\\d{2}$",
            "description": "Policy entry ID (P-NN). Never reused, even if entry retired."
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["LOCKED", "UNDER_REVIEW", "RETIRED"]
          },
          "date_locked": {
            "type": "string",
            "format": "date"
          },
          "decision_summary": {
            "type": "string",
            "description": "One-paragraph statement of the decision. Verbose detail in the markdown ledger."
          },
          "scope_summary": {
            "type": "string",
            "description": "Surfaces and contexts the decision binds across."
          },
          "rationale_layers": {
            "type": "array",
            "description": "Layered rationale. For a decision to be reopened, all layers must change (compounding rationale).",
            "items": {
              "type": "object",
              "required": ["layer", "summary"],
              "additionalProperties": false,
              "properties": {
                "layer": {
                  "type": "string",
                  "description": "Layer name (e.g. 'regulatory', 'measurement_validity', 'mission_alignment')."
                },
                "summary": {
                  "type": "string"
                }
              }
            }
          },
          "canonical_sources": {
            "type": "array",
            "items": { "type": "string" },
            "description": "Paths to canonical source documents."
          },
          "review_conditions": {
            "type": "string",
            "description": "What conditions would trigger entry review."
          },
          "operational_consequence": {
            "type": "string",
            "description": "How the decision shows up in operational practice."
          },
          "related_defense_surfaces": {
            "type": "array",
            "items": { "type": "string" },
            "description": "Related /methodology routes that operate alongside this entry."
          }
        }
      }
    },
    "candidate_entries": {
      "type": "array",
      "description": "Policy decisions documented internally and in force as product commitments, but not yet formalized into ledger entries. Each will receive a full entry on its next scheduled review or first public-facing citation need.",
      "items": {
        "type": "object",
        "required": ["id", "title", "summary"],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^P-\\d{2}$",
            "description": "Candidate ID. Reserved on the formalization queue."
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "canonical_source": {
            "type": "string"
          }
        }
      }
    },
    "version_history": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["version", "date", "summary"],
        "additionalProperties": false,
        "properties": {
          "version": {
            "type": "string",
            "pattern": "^v\\d+(\\.\\d+)*$"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "summary": {
            "type": "string"
          }
        }
      }
    }
  }
}
