{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gxplex.com/api/v1/schema/events.json",
  "title": "Recorded act document",
  "description": "The document served at /api/v1/events.json. Items are carried under `items`.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://gxplex.com/api/v1/schema/envelope.json"
    }
  ],
  "properties": {
    "collection": {
      "const": "events"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/item"
      },
      "description": "Every recorded act this document carries."
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": true,
  "$defs": {
    "item": {
      "type": "object",
      "title": "Recorded act",
      "description": "One act this record performed and has already published on a reader surface, with the day it happened and the address it is published at.",
      "properties": {
        "licence_class": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "open",
            "restricted",
            "unknown",
            null
          ],
          "description": "What this archive recorded of the terms the source states. Null where no reading exists for this object. See `rights` on the envelope."
        },
        "text_retained": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether normalised prose of the document is held here for a quotation to be checked against. Held, never served. Null where no reading exists."
        },
        "quote_allowed": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether a quotation from the document appears in this record's own published output. A fact about this record's handling, not a reading of what the publisher permits, and not a grant. Null where no reading exists."
        },
        "snapshot_available": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether a retained snapshot of an observed retrieval is still held here for a digest to be re-checked against. No snapshot is served. Null where no reading exists."
        },
        "rights_of": {
          "type": [
            "string",
            "null"
          ],
          "description": "The tracked entry id the four fields above are the rights OF. Null where the object names no entry."
        },
        "rights_unresolved": {
          "type": [
            "string",
            "null"
          ],
          "description": "Present only where the four fields are null, naming which absence it is: an id this record does not hold, or an object that names no entry."
        },
        "id": {
          "type": "string",
          "description": "A stable address for this event, derived from the store rather than minted. It does not change between builds."
        },
        "type": {
          "type": "string",
          "description": "What kind of act this was. Derived from the stored fields named in `basis` on the envelope, never assigned by a classifier here."
        },
        "occurred_on": {
          "type": "string",
          "format": "date",
          "description": "The day the act is recorded against, at day granularity."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The document the act concerns, or null where the act concerns an axis over documents rather than one document."
        },
        "subject_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "The page the subject of this event is published at, or null where the subject has no page."
        },
        "published_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reader surface this act is published on. Every event has one: an act with no published surface is not in this stream."
        },
        "detail": {
          "type": "object",
          "description": "Fields copied from the store unchanged. Their keys differ by type and are named in `basis` on the envelope."
        }
      },
      "required": [
        "id",
        "type",
        "occurred_on",
        "published_at",
        "licence_class",
        "text_retained",
        "quote_allowed",
        "snapshot_available",
        "rights_of"
      ],
      "additionalProperties": true
    }
  }
}
