{
  "$defs": {
    "EntryGaps": {
      "description": "What a reading could not key, read or trust, counted rather than hidden.",
      "properties": {
        "failed_check_digits": {
          "default": 0,
          "minimum": 0,
          "title": "Failed Check Digits",
          "type": "integer"
        },
        "repeated_keys": {
          "default": [],
          "description": "Every key one table prints more than once.",
          "items": {
            "$ref": "#/$defs/KeyRef"
          },
          "title": "Repeated Keys",
          "type": "array"
        },
        "unkeyed_rows": {
          "default": 0,
          "minimum": 0,
          "title": "Unkeyed Rows",
          "type": "integer"
        },
        "unrecognised_tables": {
          "default": 0,
          "minimum": 0,
          "title": "Unrecognised Tables",
          "type": "integer"
        }
      },
      "title": "EntryGaps",
      "type": "object"
    },
    "EntryTable": {
      "description": "A table whose rows are read as entries: how its key is named, and its header rows.",
      "properties": {
        "container": {
          "$ref": "#/$defs/ProvisionLocation",
          "description": "The deepest located node holding the table, as the tree places it."
        },
        "header": {
          "default": [],
          "description": "The header rows, cells verbatim; `None` where a span covers.",
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "title": "Header",
          "type": "array"
        },
        "key_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "How a key is named in prose, or `None` when the key is the entry's name.",
          "title": "Key Label"
        },
        "table": {
          "description": "1-based ordinal among every table in the container.",
          "minimum": 1,
          "title": "Table",
          "type": "integer"
        },
        "unit": {
          "$ref": "#/$defs/ProvisionLocation",
          "description": "The top-level unit the table sits in."
        }
      },
      "required": [
        "unit",
        "container",
        "table",
        "key_label"
      ],
      "title": "EntryTable",
      "type": "object"
    },
    "Identifier": {
      "description": "One identifier a row carries, in the canonical form of its scheme.",
      "properties": {
        "scheme": {
          "description": "The corpus-defined scheme name, lower case.",
          "title": "Scheme",
          "type": "string"
        },
        "value": {
          "description": "The canonical spelling of the value under its scheme.",
          "title": "Value",
          "type": "string"
        }
      },
      "required": [
        "scheme",
        "value"
      ],
      "title": "Identifier",
      "type": "object"
    },
    "KeyRef": {
      "description": "One key of one table, named without its rows.",
      "properties": {
        "container": {
          "$ref": "#/$defs/ProvisionLocation",
          "description": "The located node holding the table."
        },
        "key": {
          "description": "The key as the entry carries it.",
          "title": "Key",
          "type": "string"
        },
        "table": {
          "description": "1-based ordinal among every table in the container.",
          "minimum": 1,
          "title": "Table",
          "type": "integer"
        }
      },
      "required": [
        "container",
        "table",
        "key"
      ],
      "title": "KeyRef",
      "type": "object"
    },
    "ProvisionLocation": {
      "type": "string"
    },
    "TableEntry": {
      "description": "A keyed group of rows, with its identifiers and its cells verbatim.",
      "properties": {
        "container": {
          "$ref": "#/$defs/ProvisionLocation",
          "description": "The deepest located node holding the table, as the tree places it."
        },
        "failed_check_digits": {
          "default": 0,
          "description": "Identifier-shaped values in identifier columns that fail.",
          "minimum": 0,
          "title": "Failed Check Digits",
          "type": "integer"
        },
        "group": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Verbatim heading of the innermost block the rows sit in.",
          "title": "Group"
        },
        "identifiers": {
          "default": [],
          "description": "Sorted, deduplicated, and valid under the scheme's check.",
          "items": {
            "$ref": "#/$defs/Identifier"
          },
          "title": "Identifiers",
          "type": "array"
        },
        "key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The row key by the adapter's rule; `None` is an unkeyed row, kept and counted.",
          "title": "Key"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "First line of the name cell; a leading entry number and its `.` dropped.",
          "title": "Name"
        },
        "occurrence": {
          "default": 1,
          "description": "1-based among this table's entries sharing this key.",
          "minimum": 1,
          "title": "Occurrence",
          "type": "integer"
        },
        "rows": {
          "description": "Every row of the entry, cells verbatim; `None` where a span covers.",
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "title": "Rows",
          "type": "array"
        },
        "table": {
          "description": "1-based ordinal among every table in the container.",
          "minimum": 1,
          "title": "Table",
          "type": "integer"
        },
        "unit": {
          "$ref": "#/$defs/ProvisionLocation",
          "description": "The top-level unit the table sits in."
        }
      },
      "required": [
        "unit",
        "container",
        "table",
        "key",
        "rows"
      ],
      "title": "TableEntry",
      "type": "object"
    },
    "TableRef": {
      "description": "Which table of which unit: the unit, the located node holding it, and its ordinal.",
      "properties": {
        "container": {
          "$ref": "#/$defs/ProvisionLocation",
          "description": "The deepest located node holding the table, as the tree places it."
        },
        "table": {
          "description": "1-based ordinal among every table in the container.",
          "minimum": 1,
          "title": "Table",
          "type": "integer"
        },
        "unit": {
          "$ref": "#/$defs/ProvisionLocation",
          "description": "The top-level unit the table sits in."
        }
      },
      "required": [
        "unit",
        "container",
        "table"
      ],
      "title": "TableRef",
      "type": "object"
    }
  },
  "$id": "register.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Every table entry of one version of one act, with what could not be read, counted.",
  "properties": {
    "corpus": {
      "description": "The act's corpus namespace.",
      "title": "Corpus",
      "type": "string"
    },
    "coverage": {
      "$ref": "#/$defs/EntryGaps",
      "default": {
        "failed_check_digits": 0,
        "repeated_keys": [],
        "unkeyed_rows": 0,
        "unrecognised_tables": 0
      },
      "description": "What the reading could not key, read or trust."
    },
    "disclaimer": {
      "default": "Not legal advice: this output is machine-computed from published texts, carries no lawyer's review, and is engineering assistance only.",
      "description": "Not legal advice.",
      "title": "Disclaimer",
      "type": "string"
    },
    "entries": {
      "default": [],
      "description": "Every entry, in document order: table position, then row order.",
      "items": {
        "$ref": "#/$defs/TableEntry"
      },
      "title": "Entries",
      "type": "array"
    },
    "key": {
      "description": "The act's key within its corpus.",
      "title": "Key",
      "type": "string"
    },
    "register_schema": {
      "default": "1.0",
      "description": "The register format's version.",
      "title": "Register Schema",
      "type": "string"
    },
    "tables": {
      "default": [],
      "description": "Every table read as entries, in document order.",
      "items": {
        "$ref": "#/$defs/EntryTable"
      },
      "title": "Tables",
      "type": "array"
    },
    "unrecognised": {
      "default": [],
      "description": "Profiled positions whose header did not match; never read.",
      "items": {
        "$ref": "#/$defs/TableRef"
      },
      "title": "Unrecognised",
      "type": "array"
    },
    "version": {
      "description": "The version the entries were read from: the newest held.",
      "title": "Version",
      "type": "string"
    }
  },
  "required": [
    "corpus",
    "key",
    "version"
  ],
  "title": "register",
  "type": "object"
}
