{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.4/review/receipt-predicate.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal review, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "Issue receipt predicate",
  "description": "The predicate of a host's receipt of an issue, https://openeik.org/attestation/issue-receipt/v0.1 (Part XVIII, 5.2): the issue by its id and hash, the host as people know it, the recipient, one the issue names or one the host sent it to, and then who on the host sent it (sentBy) and the host's own id for that sending (transmittal), which a validator asks for in code (XVIII.5.3, rule 3); the events the host saw for that recipient, oldest first, by the host's clock, a print the issue does not list named with what it was printed from (of); and when the host made the receipt. Signed with a key the host publishes, which a verifier is given as a trust anchor.",
  "type": "object",
  "properties": {
    "issue": {
      "description": "The issue, by its id and its record's hash.",
      "type": "object",
      "properties": {
        "id": {
          "$ref": "../drawings/defs.schema.json#/$defs/id"
        },
        "hash": {
          "description": "The issue record's hash (Part III, 6), which is also the statement's subject's digest.",
          "$ref": "../drawings/defs.schema.json#/$defs/hash"
        }
      },
      "required": [
        "id",
        "hash"
      ],
      "x-eik-closed": true
    },
    "host": {
      "description": "The host, as people know it: never its URL.",
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        }
      },
      "required": [
        "name"
      ],
      "x-eik-closed": true
    },
    "recipient": {
      "$ref": "../drawings/issue.schema.json#/$defs/recipient"
    },
    "sentBy": {
      "description": "For a recipient the issue does not name: who on the host sent the issue to them, a person of the registry.",
      "type": "object",
      "properties": {
        "person": {
          "$ref": "../drawings/defs.schema.json#/$defs/person"
        }
      },
      "required": [
        "person"
      ],
      "x-eik-closed": true
    },
    "transmittal": {
      "description": "For a recipient the issue does not name: the host's own id for that sending, unique only together with the receipt's host.name, which nothing in the building resolves.",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "events": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10000,
      "items": {
        "description": "An event (XVIII.5.1): what happened, and when; what it was about, a revision, a version or a print, and what a print the issue does not list was printed from; and for superseded, the later issue.",
        "type": "object",
        "properties": {
          "event": {
            "type": "string",
            "enum": [
              "sent",
              "delivered",
              "opened",
              "viewed",
              "downloaded",
              "withdrawn",
              "superseded"
            ]
          },
          "at": {
            "description": "When it happened, by the host's clock.",
            "$ref": "../drawings/defs.schema.json#/$defs/time"
          },
          "drawing": {
            "$ref": "../drawings/defs.schema.json#/$defs/number"
          },
          "sequence": {
            "type": "integer",
            "minimum": 1
          },
          "root": {
            "description": "A version the issue releases, by its root.",
            "$ref": "../drawings/defs.schema.json#/$defs/hash"
          },
          "sha256": {
            "description": "A print the issue names, by its digest.",
            "$ref": "../drawings/defs.schema.json#/$defs/hash"
          },
          "of": {
            "description": "For a print the issue does not list, as a host prints on demand: what it was printed from, a revision or a version the issue releases (XVIII.5.3, rule 5).",
            "$ref": "../drawings/issue.schema.json#/$defs/rendition/properties/of"
          },
          "issue": {
            "description": "For superseded: the later issue's id.",
            "$ref": "../drawings/defs.schema.json#/$defs/id"
          }
        },
        "required": [
          "event",
          "at"
        ],
        "dependentRequired": {
          "drawing": [
            "sequence"
          ],
          "sequence": [
            "drawing"
          ]
        },
        "x-eik-closed": true
      }
    },
    "at": {
      "description": "When the host made the receipt: it holds the events until then.",
      "$ref": "../drawings/defs.schema.json#/$defs/time"
    }
  },
  "required": [
    "issue",
    "host",
    "recipient",
    "events",
    "at"
  ],
  "x-eik-closed": true
}
