{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gxplex.com/api/v1/schema/compare.json",
  "title": "Comparable readings of a tracked row document",
  "description": "The document served at /api/v1/compare.json. Items are carried under `items`.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://gxplex.com/api/v1/schema/envelope.json"
    }
  ],
  "properties": {
    "collection": {
      "const": "compare"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/item"
      },
      "description": "Every comparable readings of a tracked row this document carries."
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": true,
  "$defs": {
    "item": {
      "type": "object",
      "title": "Comparable readings of a tracked row",
      "description": "One tracked row: the distinct digests of the normalised text this record retained for it, each addressed by the day and sequence of the observation that first held it, and every pair of those points with one verdict. The words that differ are not carried; the page named in each pair carries them, under the quotation ceiling.",
      "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": "The tracked row."
        },
        "url": {
          "type": "string",
          "description": "The comparison page for the row."
        },
        "row_url": {
          "type": "string",
          "description": "The row's own page."
        },
        "series_state": {
          "type": "string",
          "enum": [
            "no-digest",
            "no-retained-text",
            "one-point",
            "comparable"
          ],
          "description": "Which absence a row with nothing to compare holds, or `comparable`. The envelope's `population.series_state_means` states each value."
        },
        "points_interleave": {
          "type": "boolean",
          "description": "True where a digest was observed again after a later one had appeared: the points are then readings ordered by first sighting, not a sequence of versions."
        },
        "points": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "One per distinct digest: `observed_date`, `sequence`, `content_hash`, `answered_url`, `asked_url`, `observation_class`, `normalised_from`, `first_observed`, `last_observed`, `days_observed`, `observations` and `content_length`."
        },
        "comparisons": {
          "type": "array",
          "items": {
            "type": "object"
          },
          "description": "One per pair of points: `from` and `to` (day, sequence, digest), `verdict`, `refused_by`, `refusal_kind`, `refusal_detail`, the word figures where a difference was measured, `structure` on a withheld pair, `structure_absent` and `page`."
        }
      },
      "required": [
        "id",
        "url",
        "row_url",
        "series_state",
        "points_interleave",
        "points",
        "comparisons",
        "licence_class",
        "text_retained",
        "quote_allowed",
        "snapshot_available",
        "rights_of"
      ],
      "additionalProperties": true
    }
  }
}
