{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gxplex.com/api/v1/schema/signals.json",
  "title": "Signal document",
  "description": "The document served at /api/v1/signals.json. Items are carried under `items`.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://gxplex.com/api/v1/schema/envelope.json"
    }
  ],
  "properties": {
    "collection": {
      "const": "signals"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/item"
      },
      "description": "Every signal this document carries."
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": true,
  "$defs": {
    "item": {
      "type": "object",
      "title": "Signal",
      "description": "One entry a publisher listed on a surface this archive reads, with the class the publisher stated, the day it was retrieved here, and its distance from the source on the filed scale. A signal is a record that a publisher published something; it states nothing about what any document requires.",
      "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."
        },
        "source": {
          "type": "object",
          "description": "The tracked entry this object is about, its state, and where it resolves on this site. `state` is one of `tracked` (this record holds the entry), `not-tracked` (an id is named and this record holds no entry under it) or `no-subject` (the object names no entry, so no lookup applies). `resolves_to` carries an address only where the state is `tracked`; a minted address for an untracked id would 404, and a consumer cannot tell a 404 from a deploy that dropped a file."
        },
        "observed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "The day THIS RECORD observed the fact this object carries, at day granularity. It is never a publisher's own date for an event and never a build clock. Null where no such day was read."
        },
        "observed_at_state": {
          "type": "string",
          "enum": [
            "recorded",
            "not-carried",
            "not-an-observation"
          ],
          "description": "Which of the two absences a null `observed_at` is. `not-carried`: this object is a record about something observable and carries no day for when this record read it. `not-an-observation`: this object is not a record of a retrieval at all — a corpus summary, a coverage term — so no day is missing from it. Opposite facts, one blank."
        },
        "observed_at_read_from": {
          "type": [
            "string",
            "null"
          ],
          "description": "The key on the emitting store `observed_at` was read from, so the value can be checked against the store rather than trusted. Null only where the state is `not-an-observation`, which is the one case with no field to name."
        },
        "distance": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "Distance from the source on the filed scale — 0 primary, 1 official notice, 2 official related record, 3 third-party. Defined for signals only. Null on every other object, and a null is NOT zero: zero is the strongest claim the scale makes."
        },
        "distance_label": {
          "type": [
            "string",
            "null"
          ],
          "description": "The scale's own word for `distance`, read from the one home that holds the scale. Null where no distance was read, and null where the record's own label disagrees with the scale — a disagreement is withheld rather than reconciled, because neither side adjudicates the other."
        },
        "distance_state": {
          "type": "string",
          "enum": [
            "recorded",
            "unmeasured",
            "field-absent",
            "out-of-scale",
            "label-disagrees",
            "not-a-signal"
          ],
          "description": "Which reading produced `distance`. `not-a-signal`: this object has no position on the scale. `field-absent`: the record carries no distance key. `unmeasured`: the key is present and null — the entry declared no address to measure from. `out-of-scale`: the record's value is not a member of the scale, so no value is published. `label-disagrees`: the value IS a member and the record's own label is not the scale's word for it, so the value is published and the LABEL is withheld — the two are different withholdings and one sentence covering both said the value was withheld in a case where it is served."
        },
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The identifier the collector recorded for this entry. Null where the record carries none, which is counted apart from the records that can be addressed."
        },
        "collected_from": {
          "type": "string",
          "description": "The source whose store this record was read from."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The tracked entry the collector matched this signal to, or null where it matched none. Null is a signal with no subject in this corpus, not a failed match."
        },
        "source_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "The address the publisher gave for the entry."
        },
        "source_url_provenance": {
          "type": [
            "string",
            "null"
          ],
          "description": "Whether the address above was requested or only declared by the publisher inside the listing. A declared address is not a retrieval."
        },
        "published": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "The day the publisher states for the entry. Not the day this archive read it."
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "The publisher's own title, under the envelope word ceiling. Null where it is absent or withheld."
        },
        "title_withheld": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why no title is published: `absent`, `over-cap`, or `flag-disagrees`. A title over the ceiling is withheld whole, never trimmed."
        },
        "title_withheld_basis": {
          "type": [
            "string",
            "null"
          ],
          "description": "Whether the ceiling verdict came from the record's own stored field or from this reader's count."
        },
        "title_words": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Words this reader counted in the publisher's title."
        },
        "signal_class": {
          "type": [
            "string",
            "null"
          ],
          "description": "The class the publisher stated, where it is one of the filed vocabulary and the record's own state agrees with its own value."
        },
        "signal_class_state": {
          "type": "string",
          "description": "Which reading produced the class: `publisher-stated`, `stated-not-in-the-twelve`, `no-class-self-stated`, `writer-state-absent`, or `state-and-value-disagree`. The last two are facts about the record rather than about the publisher."
        },
        "signal_class_basis": {
          "type": [
            "string",
            "null"
          ],
          "description": "The collector's own account of how it reached the class, carried verbatim."
        },
        "signal_class_named": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Every class the publisher's own tokens named, as the collector recorded them. Empty is a publisher that named none; the field being absent from a record is a different fact."
        },
        "authority": {
          "type": [
            "string",
            "null"
          ],
          "description": "The host the entry was published on. A host, never a person: no author, editor or contributor element is read into any field."
        },
        "authority_state": {
          "type": "string",
          "description": "`recorded`, `unmeasured`, or `field-absent`."
        },
        "authority_basis": {
          "type": [
            "string",
            "null"
          ],
          "description": "The collector's own account of how the host was reached."
        },
        "attached_source_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Tracked entries named by every address the publisher declared for this entry. A superset of `instrument_id`, never a replacement for it."
        },
        "attached_state": {
          "type": "string",
          "description": "`recorded`, or `field-absent` for a record written before the field existed."
        },
        "addresses_declared": {
          "type": [
            "integer",
            "null"
          ],
          "description": "How many addresses the publisher declared for the entry. Null where the record carries no figure; never coalesced to a number."
        },
        "distance_from_source_basis": {
          "type": [
            "string",
            "null"
          ],
          "description": "The collector's own account of how the distance was reached."
        },
        "from_fixture": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether the record came from a synthetic fixture rather than from a publisher. Null where the record declares no origin — not the safe case assumed."
        },
        "content_hash": {
          "type": [
            "string",
            "null"
          ],
          "description": "A digest of the entry as it was read."
        }
      },
      "required": [
        "collected_from",
        "instrument_id",
        "signal_class",
        "signal_class_state",
        "authority",
        "authority_state",
        "licence_class",
        "text_retained",
        "quote_allowed",
        "snapshot_available",
        "rights_of",
        "source",
        "observed_at",
        "observed_at_state",
        "observed_at_read_from",
        "distance",
        "distance_label",
        "distance_state"
      ],
      "additionalProperties": true
    }
  }
}
