{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://plenaverify.com/vrx1-correction-trail-receipt.schema.json",
  "title": "PLENA VRX-1 Correction-Trail Receipt v1",
  "description": "Schema for VRX-1 Receipt Type 6, the Correction-Trail Receipt. Records that a prior receipt has been amended, withdrawn, sharpened, or superseded. Points back at the receipt being corrected; records the corrector, the kind and substance of the change, the reason, and the date. Originals are not rewritten; corrections travel alongside them. The supersedes pointer is single-link: each Correction-Trail Receipt names only its immediate predecessor in the chain, and a chain is reconstructed by walking pointers. The correction_index field gives the position in the chain (1 = first correction; 2 = second; and so on). The receipt is self-attested by its creator and tamper-evident via SHA-256 over the canonical JSON; it is not signed by an issuer key, not externally anchored to a public timestamp, and not certified by PLENA or any third party. Acceptance is decided by the receiving party. The schema is the canonical contract for VRX-1 Correction-Trail Receipts produced by the d19.82 reference implementation at vrx1-correction-trail-receipt.html.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "vrx1_version",
    "schema_version",
    "receipt_id",
    "receipt_type",
    "created_at",
    "corrected_receipt_id",
    "corrected_receipt_type",
    "corrector_name_or_role",
    "correction_index",
    "correction_kind",
    "correction_summary",
    "correction_reason",
    "corrected_at",
    "privacy_level",
    "verification_url",
    "integrity_note",
    "hash"
  ],
  "properties": {
    "vrx1_version": {
      "type": "string",
      "const": "1.0-d19.82-correction-trail-receipt-reference",
      "description": "VRX-1 reference-implementation version string."
    },
    "schema_version": {
      "type": "string",
      "const": "vrx1.correction-trail-receipt.v1",
      "description": "Stable schema identifier for VRX-1 Correction-Trail Receipt v1."
    },
    "receipt_id": {
      "type": "string",
      "pattern": "^PLENA-CTR-[0-9]{8}-[A-F0-9]{4}$",
      "description": "Unique identifier for this receipt. Format: PLENA-CTR-<YYYYMMDD>-<4 uppercase hex>."
    },
    "receipt_type": {
      "type": "string",
      "const": "CORRECTION_TRAIL_RECEIPT",
      "description": "Receipt type discriminator. Always CORRECTION_TRAIL_RECEIPT for this schema."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 date-time string from the device that built the receipt."
    },
    "corrected_receipt_id": {
      "type": "string",
      "minLength": 1,
      "description": "The receipt_id of the receipt whose content this correction amends. Format mirrors any of the six gating receipt id patterns."
    },
    "corrected_receipt_type": {
      "type": "string",
      "enum": [
        "SUBMISSION_RECEIPT",
        "MISSING_ITEM_RECEIPT",
        "HUMAN_REVIEW_RECEIPT",
        "REFUSAL_RECEIPT",
        "DEADLINE_RECEIPT",
        "CORRECTION_TRAIL_RECEIPT",
        "OTHER"
      ],
      "description": "Type of the receipt being corrected. 'CORRECTION_TRAIL_RECEIPT' is allowed when this receipt corrects an earlier correction. 'OTHER' covers future receipt types not yet in the gating six."
    },
    "corrector_name_or_role": {
      "type": "string",
      "minLength": 1,
      "description": "Name or role title of the human corrector."
    },
    "corrector_org_or_context": {
      "type": [
        "string",
        "null"
      ],
      "description": "Corrector's institution or role context. Optional."
    },
    "correction_index": {
      "type": "integer",
      "minimum": 1,
      "description": "Position of this correction in the chain for the corrected_receipt_id. 1 = first correction; 2 = second; and so on. A reader walking the chain can verify that correction_index increments by one at each step."
    },
    "correction_kind": {
      "type": "string",
      "enum": [
        "factual_error",
        "typo",
        "missing_information_added",
        "superseded_by_review",
        "withdrawn",
        "clarification",
        "other"
      ],
      "description": "Kind of correction. 'factual_error' = a fact was wrong. 'typo' = a wording correction with no factual change. 'missing_information_added' = information that should have been recorded was not. 'superseded_by_review' = a later review supersedes the original decision. 'withdrawn' = the original is no longer valid. 'clarification' = meaning sharpened without changing facts."
    },
    "correction_summary": {
      "type": "string",
      "minLength": 1,
      "description": "Free-text description of what changed. Should be specific enough that a reader comparing the original receipt and this Correction-Trail Receipt can see the delta."
    },
    "correction_reason": {
      "type": "string",
      "minLength": 1,
      "description": "Free-text reason for the correction."
    },
    "corrected_at": {
      "type": "string",
      "minLength": 1,
      "description": "ISO-8601 date or date-time of the correction event itself (distinct from the created_at timestamp of the receipt build)."
    },
    "supersedes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Single-link pointer to the immediately prior Correction-Trail Receipt in the chain. Null when correction_index = 1 (the chain starts here, pointing at corrected_receipt_id). When correction_index >= 2, this should reference the prior Correction-Trail Receipt; a chain is reconstructed by walking pointers, not by serialising the whole chain inside each receipt."
    },
    "linked_human_review_receipt_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional Human Review Receipt id that authorised the correction. Format: PLENA-HRR-<YYYYMMDD>-<4 hex> when present."
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional free-text notes."
    },
    "privacy_level": {
      "type": "string",
      "enum": [
        "restricted",
        "private",
        "public"
      ],
      "description": "Privacy classification."
    },
    "verification_url": {
      "type": "string",
      "minLength": 1,
      "description": "URL where the receipt can be opened in the VRX-1 Correction-Trail Receipt reference implementation Verify panel."
    },
    "integrity_note": {
      "type": "string",
      "minLength": 1,
      "description": "Plain-language statement of the receipt's truth boundary."
    },
    "hash": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$",
      "description": "SHA-256 hex digest over canonical JSON without the 'hash' field."
    }
  }
}
