{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://qollqa.org/schema/contribution/v0.1",
  "title": "Qollqa Contribution Schema v0.1",
  "description": "A contributed CHECK RECORD. A contributor submits what was checked; the register determines what the check found and writes the Register Entry. The two are separate objects on purpose: a contributor cannot mark its own answer correct.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "check_id",
    "checked_at",
    "citation",
    "claim_hash",
    "jurisdiction",
    "requester_class"
  ],
  "properties": {
    "schema_version": {
      "const": "0.1",
      "description": "Pinned. A contribution against an unknown version is rejected rather than coerced."
    },
    "check_id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{8,64}$",
      "description": "The contributor's own identifier for this check. Opaque to the register; used only so the contributor can reconcile its submission against its report. Must not encode a matter number, a client, or a person."
    },
    "checked_at": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339, UTC. When the check was performed, not when it was submitted."
    },
    "citation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["raw", "type"],
      "description": "The authority as it appeared in the material checked. The register normalizes; the contributor does not have to.",
      "properties": {
        "raw": {
          "type": "string",
          "minLength": 3,
          "maxLength": 512,
          "description": "Verbatim citation text. This is a citation, not claim text: it is not covered by the zero-retention warranty because it is not content."
        },
        "type": {
          "enum": ["case", "statute", "regulation", "rule", "secondary", "other"]
        },
        "normalized": {
          "type": "string",
          "maxLength": 512,
          "description": "Optional. If the contributor already normalizes, send it; the register recomputes and records both."
        }
      }
    },
    "claim_hash": {
      "type": "object",
      "additionalProperties": false,
      "required": ["alg", "value"],
      "description": "A hash of the proposition the authority was cited for. THE TEXT ITSELF IS NEVER SUBMITTED. This is the hash-first architecture of Terms 6.4 carried into contribution: a contributor can join on the hash without disclosing work product.",
      "properties": {
        "alg": { "const": "sha256" },
        "value": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "canonicalization": {
          "const": "qollqa-claim-c14n-v1",
          "description": "Required if value is to be joinable across contributors. Without a stated canonicalization two contributors hashing the same proposition produce different digests."
        }
      }
    },
    "jurisdiction": {
      "type": "object",
      "additionalProperties": false,
      "required": ["country"],
      "properties": {
        "country": { "type": "string", "pattern": "^[A-Z]{2}$" },
        "court_id": {
          "type": "string",
          "maxLength": 64,
          "description": "Canonical court identifier where known (the register's court_id, e.g. 'nd-california'). A free-text court name is NOT accepted: the register has already had to collapse label variants once."
        }
      }
    },
    "system": {
      "type": "object",
      "additionalProperties": false,
      "description": "The machine system that produced the citation. OPTIONAL, and the single most valuable field in the schema: 77.3% of findings in the public corpus do not identify the system, because a court had no reason to name it. A contributor knows. Identifiers are drawn from a published registry; free text is not accepted, because the source field this replaces carries one vendor under seven spellings and cannot support a count.",
      "required": ["system_id"],
      "properties": {
        "system_id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
          "maxLength": 64,
          "description": "From the published system registry. Unknown identifiers are quarantined for curation, never silently coined."
        },
        "version": { "type": "string", "maxLength": 64 },
        "surface": {
          "enum": ["chat", "api", "embedded-research", "drafting-assistant", "agent", "other"]
        }
      }
    },
    "requester_class": {
      "enum": [
        "attorney",
        "paralegal",
        "expert",
        "in-house",
        "self-represented",
        "vendor-internal",
        "other"
      ],
      "description": "A CLASS, never a person, a firm, or a bar number. Terms 7.3 governs: outcomes attach to citations and claims, never to persons."
    },
    "outcome_asserted": {
      "enum": ["verified", "nonexistent", "mischaracterized", "superseded", "indeterminate"],
      "description": "OPTIONAL and NON-BINDING. What the contributor's own tooling concluded. It is recorded as an assertion and compared against the register's determination; it never becomes the Register Entry's outcome. This field is the neutrality mechanism: a contributor supplies checks requested, the register determines what the check found."
    },
    "disposition": {
      "type": "object",
      "additionalProperties": false,
      "description": "Optional. What happened downstream, where the contributor knows.",
      "properties": {
        "corrected_before_filing": { "type": "boolean" },
        "reached_a_tribunal": { "type": "boolean" },
        "finding_made": {
          "type": "boolean",
          "description": "A court made a finding. If true, cite it — the register will not take this on assertion."
        },
        "finding_citation": { "type": "string", "maxLength": 512 }
      }
    }
  },
  "$comment": "NOT IN THIS SCHEMA, deliberately: contributor identity, matter or docket identifier of the contributor's own file, client name, attorney name or bar number, claim text, document content, billing data, monetary amount asserted by the contributor. A contribution that would be materially less useful without one of these is out of scope for v0.1."
}
