{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://usedeed.app/contracts/deed.design_spec_matrix.v1.schema.json",
  "title": "DEED design specification matrix v1",
  "description": "Current executable design-specification index and formal proof binding for DEED.",
  "type": "object",
  "required": ["$schema", "program", "version", "primitiveCount", "distinctClassCount", "sourceRoot", "requiredSources", "proof", "ciCommands", "rows"],
  "properties": {
    "$schema": { "const": "https://usedeed.app/contracts/deed.design_spec_matrix.v1.schema.json" },
    "program": { "const": "First-Class DEED Design Spec Execution" },
    "version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
    "primitiveCount": { "type": "integer", "minimum": 1 },
    "distinctClassCount": { "type": "integer", "minimum": 1 },
    "sourceRoot": { "const": "DEED/specs" },
    "requiredSources": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
    "proof": {
      "type": "object",
      "required": ["module", "runtimeBridge", "verifier", "stateType", "qStatus", "agda", "cubicalCommit"],
      "properties": {
        "module": { "const": "formal/DEED/QAnamorphism.agda" },
        "runtimeBridge": { "const": "formal/runtime-frontier-state.mjs" },
        "verifier": { "const": "npm run formal:check" },
        "stateType": { "const": "DEED.QAnamorphism.FrontierState" },
        "qStatus": { "const": "proven" },
        "agda": { "type": "string", "minLength": 1 },
        "cubicalCommit": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
      },
      "additionalProperties": false
    },
    "ciCommands": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
    "rows": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["source", "posture", "owner", "status", "artifacts", "verifiers", "evidence"],
        "properties": {
          "source": { "type": "string", "minLength": 1 },
          "posture": { "enum": ["build", "verify-only", "do-not-implement"] },
          "owner": { "type": "string", "minLength": 1 },
          "status": { "type": "string", "minLength": 1 },
          "artifacts": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
          "verifiers": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
          "evidence": { "type": "string", "minLength": 1 }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
