{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "format_version": {
      "type": "number",
      "const": 1
    },
    "exported_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))$"
    },
    "tenant": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "included_tenant_ids": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "requested_by": {
      "type": "string"
    },
    "access_note": {
      "type": "string"
    },
    "totals": {
      "type": "object",
      "properties": {
        "tables": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "tables_with_rows": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "tables_not_readable": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "records": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "attachments": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "attachments_not_included": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "tables",
        "tables_with_rows",
        "tables_not_readable",
        "records",
        "attachments",
        "attachments_not_included"
      ],
      "additionalProperties": false
    },
    "tables": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "table": {
            "type": "string"
          },
          "records": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "files": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "skipped": {
            "type": "string"
          }
        },
        "required": [
          "table",
          "records",
          "files"
        ],
        "additionalProperties": false
      }
    },
    "attachments_not_included": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "reason"
        ],
        "additionalProperties": false
      }
    },
    "files": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1
          },
          "bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        },
        "required": [
          "path",
          "bytes",
          "sha256"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "format_version",
    "exported_at",
    "tenant",
    "included_tenant_ids",
    "requested_by",
    "access_note",
    "totals",
    "tables",
    "attachments_not_included",
    "files"
  ],
  "additionalProperties": false,
  "title": "Tenant export manifest, format version 1"
}
