{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://quickiso.app/data-portability/tables/document_versions.schema.json",
  "title": "tables/document_versions.json",
  "description": "The rows of the table document_versions that belong to the workspace, one object per row, keyed by the database's column names.",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "organization_id": {
        "type": "string",
        "format": "uuid"
      },
      "document_id": {
        "type": "string",
        "format": "uuid"
      },
      "version_number": {
        "type": "integer"
      },
      "status": {
        "type": "string",
        "enum": [
          "draft",
          "in_review",
          "approved",
          "effective",
          "obsolete"
        ]
      },
      "content": {
        "type": [
          "object",
          "array",
          "string",
          "number",
          "boolean",
          "null"
        ]
      },
      "content_hash": {
        "type": "string"
      },
      "locale": {
        "type": "string",
        "enum": [
          "en",
          "pl"
        ]
      },
      "provenance": {
        "type": [
          "object",
          "array",
          "string",
          "number",
          "boolean",
          "null"
        ]
      },
      "ai_job_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "created_by": {
        "type": "string",
        "format": "uuid"
      },
      "created_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "revision": {
        "type": "integer"
      },
      "submitted_by": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "submitted_at": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "review_note": {
        "type": [
          "string",
          "null"
        ]
      },
      "approved_by": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "approved_at": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      },
      "last_edited_by": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "approval_attestation": {
        "type": [
          "string",
          "null"
        ]
      },
      "effective_from": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "obsoleted_at": {
        "type": [
          "string",
          "null"
        ],
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      }
    },
    "required": [
      "id",
      "organization_id",
      "document_id",
      "version_number",
      "status",
      "content",
      "content_hash",
      "locale",
      "provenance",
      "ai_job_id",
      "created_by",
      "created_at",
      "updated_at",
      "revision",
      "submitted_by",
      "submitted_at",
      "review_note",
      "approved_by",
      "approved_at",
      "last_edited_by",
      "approval_attestation",
      "effective_from",
      "obsoleted_at"
    ],
    "additionalProperties": false
  }
}
