{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "generated_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "tables": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "table": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "nullable": {
                  "type": "boolean"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "name",
                "type",
                "nullable",
                "description"
              ],
              "additionalProperties": false
            }
          },
          "primary_key": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "foreign_keys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "columns": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "references_table": {
                  "type": "string"
                },
                "references_schema": {
                  "type": "string"
                },
                "references_columns": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "columns",
                "references_table",
                "references_schema",
                "references_columns"
              ],
              "additionalProperties": false
            }
          },
          "records": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "table",
          "description",
          "columns",
          "primary_key",
          "foreign_keys",
          "records"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "generated_at",
    "tables"
  ],
  "additionalProperties": false,
  "title": "Tenant export data dictionary, format version 1"
}
