{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://plenaverify.com/vrx1-missing-item-receipt.schema.json",
  "title": "PLENA VRX-1 Missing-Item Receipt v1",
  "description": "Schema for VRX-1 Receipt Type 2, the Missing-Item Receipt. Returned to a submitter when an application, form, claim, or document set is incomplete; lists the missing items, the reason they are required, the date by which they must be provided, the consequence if they are not, and the correction or escalation path. 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. PLENA does not certify AI systems or guarantee regulatory compliance. The schema is the canonical contract for VRX-1 Missing-Item Receipts produced by the d19.82 reference implementation at vrx1-missing-item-receipt.html.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "vrx1_version",
    "schema_version",
    "receipt_id",
    "receipt_type",
    "created_at",
    "recipient_institution_or_role",
    "submitter_or_subject",
    "submission_context",
    "missing_items",
    "consequence_of_non_provision",
    "correction_path",
    "privacy_level",
    "verification_url",
    "integrity_note",
    "hash"
  ],
  "properties": {
    "vrx1_version": {
      "type": "string",
      "const": "1.0-d19.82-missing-item-receipt-reference",
      "description": "VRX-1 reference-implementation version string. Bound to the d19.82 reference implementation; future implementations should bump this string and the corresponding schema_version together."
    },
    "schema_version": {
      "type": "string",
      "const": "vrx1.missing-item-receipt.v1",
      "description": "Stable schema identifier for VRX-1 Missing-Item Receipt v1. A later major revision would publish a v2 schema at a distinct identifier."
    },
    "receipt_id": {
      "type": "string",
      "pattern": "^PLENA-MIR-[0-9]{8}-[A-F0-9]{4}$",
      "description": "Unique identifier for this receipt. Format: PLENA-MIR-<YYYYMMDD>-<4 uppercase hex>. The date segment uses UTC at receipt creation. The hex suffix is generated by the creating device."
    },
    "receipt_type": {
      "type": "string",
      "const": "MISSING_ITEM_RECEIPT",
      "description": "Receipt type discriminator. Always MISSING_ITEM_RECEIPT for this schema."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 date-time string from the device that built the receipt. The timestamp is not anchored to an external clock or registry."
    },
    "recipient_institution_or_role": {
      "type": "string",
      "minLength": 1,
      "description": "The institution or role returning the receipt to the submitter. A role title may be used in place of a personal name."
    },
    "submitter_or_subject": {
      "type": "string",
      "minLength": 1,
      "description": "The person, case, file, or applicant the receipt is being returned to. May be a pseudonymous reference when the public receipt should not name the subject directly."
    },
    "submission_context": {
      "type": "string",
      "minLength": 1,
      "description": "Free-text description of what was submitted that was incomplete. Should include enough context for the submitter to recognise their submission."
    },
    "submission_received_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional ISO-8601 date or date-time of the original submission. May be set to null when the original submission date is not material to the receipt."
    },
    "missing_items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      },
      "description": "Ordered list of items the recipient considers missing from the submission. Each item is a free-text description. At least one item is required."
    },
    "required_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional date by which the missing items must be provided. Format: YYYY-MM-DD. May be set to null when no required-by date applies."
    },
    "consequence_of_non_provision": {
      "type": "string",
      "minLength": 1,
      "description": "Free-text description of what happens if the missing items are not provided. The receipt does not assert that the consequence is enforceable by law; it records what the recipient attested."
    },
    "correction_path": {
      "type": "string",
      "minLength": 1,
      "description": "Free-text description of how the submitter provides the missing items. Should include a contact address, drop-off location, or process step where applicable."
    },
    "escalation_path": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional escalation route if the submitter believes the request is incorrect or cannot be met."
    },
    "linked_submission_receipt_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional cross-reference to a prior VRX-1 Submission Receipt that this Missing-Item Receipt is returned against. Format: PLENA-SUB-<YYYYMMDD>-<4 hex> when present."
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional free-text notes from the recipient."
    },
    "privacy_level": {
      "type": "string",
      "enum": [
        "restricted",
        "private",
        "public"
      ],
      "description": "Privacy classification of the receipt body. 'restricted' = share by link, not publicly listed. 'private' = for personal/institutional records only. 'public' = safe for a public log when no private data is inside."
    },
    "supersedes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional receipt_id of a prior Missing-Item Receipt that this one corrects or replaces."
    },
    "verification_url": {
      "type": "string",
      "minLength": 1,
      "description": "URL where the receipt can be opened in the VRX-1 Missing-Item Receipt reference implementation Verify panel. Typically ends with vrx1-missing-item-receipt.html#verify."
    },
    "integrity_note": {
      "type": "string",
      "minLength": 1,
      "description": "Plain-language statement of the receipt's truth boundary. Asserts that the receipt is self-attested by its creator and tamper-evident via SHA-256, and explicitly denies signing, external anchoring, or third-party certification."
    },
    "hash": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$",
      "description": "SHA-256 hex digest, prefixed with 'sha256:', computed over the canonical JSON of all receipt fields except the 'hash' field itself. Canonicalisation: object keys are recursively sorted; no whitespace; strings are JSON-encoded; numbers use JSON number form; null is rendered as the literal null; non-finite numbers are rendered as null."
    }
  }
}
