{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/BTCDecoded/blvm-spec-lock/schemas/coverage_inventory_v1.json",
  "title": "blvm-spec-lock coverage inventory JSON (no --spec-path)",
  "description": "Emitted by `cargo spec-lock coverage --format json` when `--spec-path` is omitted.",
  "type": "object",
  "additionalProperties": true,
  "$defs": {
    "witness_verify_rollup_v1": {
      "type": "object",
      "additionalProperties": true,
      "required": ["passed", "failed", "partial", "not_implemented", "total"],
      "properties": {
        "passed": { "type": "integer", "minimum": 0 },
        "failed": { "type": "integer", "minimum": 0 },
        "partial": { "type": "integer", "minimum": 0 },
        "not_implemented": { "type": "integer", "minimum": 0 },
        "total": { "type": "integer", "minimum": 0 }
      }
    }
  },
  "required": [
    "total_spec_locked",
    "with_contracts",
    "without_contracts",
    "formulas_defined",
    "formulas_bound_to_rust",
    "formulas_parseable_body",
    "formula_anchor_parse_gate_ok",
    "formula_anchor_spec_missing_id",
    "formula_anchor_unparseable_body",
    "constants_defined",
    "constants_bound_to_rust",
    "formulas_verify_rollup",
    "constants_verify_rollup",
    "contract_coverage_percent",
    "by_section",
    "without_section"
  ],
  "properties": {
    "total_spec_locked": {
      "type": "integer",
      "minimum": 0
    },
    "with_contracts": { "type": "integer", "minimum": 0 },
    "without_contracts": { "type": "integer", "minimum": 0 },
    "formulas_defined": { "type": "integer", "minimum": 0 },
    "formulas_bound_to_rust": { "type": "integer", "minimum": 0 },
    "formulas_parseable_body": { "type": "integer", "minimum": 0 },
    "formula_anchor_parse_gate_ok": { "type": "integer", "minimum": 0 },
    "formula_anchor_spec_missing_id": { "type": "integer", "minimum": 0 },
    "formula_anchor_unparseable_body": { "type": "integer", "minimum": 0 },
    "constants_defined": {
      "type": "integer",
      "minimum": 0
    },
    "constants_bound_to_rust": {
      "type": "integer",
      "minimum": 0
    },
    "formulas_verify_rollup": {
      "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/witness_verify_rollup_v1" }]
    },
    "constants_verify_rollup": {
      "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/witness_verify_rollup_v1" }]
    },
    "contract_coverage_percent": { "type": "number" },
    "by_section": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": ["count", "functions"],
        "additionalProperties": true,
        "properties": {
          "count": { "type": "integer", "minimum": 0 },
          "functions": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["name", "file", "has_contracts", "contract_count"],
              "additionalProperties": true,
              "properties": {
                "name": { "type": "string" },
                "file": { "type": "string" },
                "has_contracts": { "type": "boolean" },
                "contract_count": { "type": "integer", "minimum": 0 }
              }
            }
          }
        }
      }
    },
    "without_section": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "file", "has_contracts", "contract_count"],
        "additionalProperties": true,
        "properties": {
          "name": { "type": "string" },
          "file": { "type": "string" },
          "has_contracts": { "type": "boolean" },
          "contract_count": { "type": "integer", "minimum": 0 }
        }
      }
    }
  }
}
