{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dakebu.github.io/Quantum-Computing-Block-Encoding/community/contribution.schema.json",
  "title": "QuantumComputinglib State Preparation or Block Encoding case",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "id", "title", "kind", "status", "mathematics", "lean", "provenance", "contributor", "verification", "executable", "resource", "license", "reuse_consent", "case_hash"],
  "properties": {
    "schema_version": {"const": "2.0"},
    "id": {"type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$", "minLength": 3, "maxLength": 96},
    "title": {"type": "string", "minLength": 1, "maxLength": 500},
    "kind": {"enum": ["statePreparation", "operatorBlockEncoding"]},
    "status": {"enum": ["draft", "pendingReview", "executable-screened", "verified", "rejected"]},
    "case_hash": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
    "mathematics": {
      "type": "object", "additionalProperties": false,
      "required": ["plain", "latex", "target", "normalizer", "projector", "epsilon", "semantic_tier", "assumptions"],
      "properties": {
        "plain": {"type": "string", "minLength": 1}, "latex": {"type": "string", "minLength": 1},
        "target": {"type": "string", "minLength": 1}, "normalizer": {"type": "string", "minLength": 1},
        "projector": {"type": "string", "minLength": 1}, "epsilon": {"type": "string", "minLength": 1},
        "semantic_tier": {"type": "string", "minLength": 1}, "assumptions": {"type": "array", "items": {"type": "string"}}
      }
    },
    "lean": {
      "type": "object", "additionalProperties": false,
      "required": ["imports", "code", "proposed_name", "dependencies", "root"],
      "properties": {
        "imports": {"type": "array", "items": {"type": "string", "pattern": "^[A-Za-z0-9_.]+$"}, "uniqueItems": true},
        "code": {"type": "string", "minLength": 1}, "proposed_name": {"type": "string", "minLength": 1},
        "dependencies": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "root": {"type": "string"}
      }
    },
    "provenance": {
      "type": "object", "additionalProperties": false, "required": ["source", "locator", "generated", "model_tool_version", "notes"],
      "properties": {"source": {"type": "string", "minLength": 1}, "locator": {"type": "string"}, "generated": {"type": "boolean"}, "model_tool_version": {"type": "string"}, "notes": {"type": "string"}}
    },
    "contributor": {
      "type": "object", "additionalProperties": false, "required": ["name", "credit", "contact", "display_preference"],
      "properties": {"name": {"type": "string", "minLength": 1}, "credit": {"type": "string", "minLength": 1}, "contact": {"type": "string"}, "display_preference": {"enum": ["full", "handle", "anonymous"]}}
    },
    "verification": {
      "type": "object", "additionalProperties": false, "required": ["compiler_command", "accepted", "diagnostics"],
      "properties": {"compiler_command": {"type": "string", "minLength": 1}, "accepted": {"type": "boolean"}, "diagnostics": {"type": "string"}}
    },
    "executable": {
      "type": "object", "additionalProperties": false, "required": ["advertised", "artifact", "accepted", "diagnostics"],
      "properties": {
        "advertised": {"type": "boolean"},
        "artifact": {"type": "string"},
        "accepted": {"type": "boolean"},
        "diagnostics": {"type": "string"},
        "requested_policy": {"type": ["object", "null"]},
        "actual_checks": {"type": "array", "items": {"type": "object"}},
        "canonical_ir_digest": {"type": "string", "pattern": "^$|^[a-f0-9]{64}$"},
        "lean_roots": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
        "evidence_classes": {"type": "array", "items": {"enum": ["syntaxOnly", "roundTrip", "numericUnitary", "numericCleanBlock", "leanCheckedRefinement"]}, "uniqueItems": true}
      }
    },
    "resource": {
      "type": "object", "additionalProperties": false, "required": ["convention", "record"],
      "properties": {"convention": {"type": "string", "minLength": 1}, "record": {"type": ["object", "null"]}}
    },
    "license": {"type": "object", "additionalProperties": false, "required": ["spdx", "agreed"], "properties": {"spdx": {"const": "MIT"}, "agreed": {"const": true}}},
    "reuse_consent": {"type": "object", "additionalProperties": false, "required": ["public_repository", "public_retrieval", "training_reuse"], "properties": {"public_repository": {"const": true}, "public_retrieval": {"type": "boolean"}, "training_reuse": {"type": "boolean"}}},
    "rejection_reason": {"type": "string"},
    "created_at": {"type": "string", "format": "date-time"}
  }
}
