{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/antfly/json-schema/antfly-restore-job-schema.json",
  "title": "RestoreJob",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/antfly-cluster-management-api-openapi.yml#/components/schemas/RestoreJob",
  "type": "object",
  "required": [
    "job_id",
    "attempt_id",
    "scope",
    "backup_id",
    "phase",
    "cancel_requested",
    "durability_pending_table_count",
    "published_table_count",
    "completed_table_count",
    "created_at_ms",
    "updated_at_ms"
  ],
  "properties": {
    "job_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 19,
      "pattern": "^[1-9][0-9]{0,18}$",
      "description": "Opaque durable restore-job identifier. Clients must not parse it as a number."
    },
    "idempotency_key": {
      "type": "string",
      "description": "Durable admission identity. Retain it with job_id when reconciling an uncertain schema rewrite; do not replay the DDL."
    },
    "attempt_id": {
      "type": "integer",
      "format": "int64"
    },
    "scope": {
      "type": "string",
      "enum": [
        "table",
        "cluster"
      ]
    },
    "table_name": {
      "type": "string"
    },
    "backup_id": {
      "type": "string"
    },
    "phase": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "cancelled"
      ]
    },
    "cancel_requested": {
      "type": "boolean"
    },
    "durability_pending_table_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "Number of tables whose generation publication is visible but whose parent-directory durability could not be confirmed."
    },
    "published_table_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "Number of table restore intents durably published. Published tables are adopted, not republished, after failover."
    },
    "completed_table_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "Number of published tables whose placement replicas completed restore and whose completion checkpoint is durable."
    },
    "total_table_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "Requested table count when known before execution."
    },
    "result": {
      "type": "object",
      "additionalProperties": false,
      "description": "Bounded terminal result. A committed result with durability pending means publication is visible but\nparent-directory durability was not confirmed. Cluster restores report aggregate triggered, committed,\ndurability-pending, skipped, and failed table counts plus a bounded sample of failure details.\n`failure_details_truncated` indicates that additional failures or part of a long failure detail were omitted.\nAny failed or durability-pending table makes the job phase `failed`; inspect this result for partial progress\nand use a new idempotency key when retrying a changed request.\n",
      "properties": {
        "restore": {
          "type": "string",
          "enum": [
            "triggered",
            "committed"
          ],
          "description": "Present for a single-table restore result."
        },
        "durability": {
          "type": "string",
          "enum": [
            "pending"
          ],
          "description": "Present when table publication is visible but filesystem durability could not be confirmed."
        },
        "status": {
          "type": "string",
          "enum": [
            "completed",
            "durability_pending",
            "partial",
            "failed"
          ],
          "description": "Aggregate terminal status for a cluster restore."
        },
        "triggered_table_count": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "committed_table_count": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "durability_pending_table_count": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "skipped_table_count": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "failed_table_count": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "failure_details": {
          "type": "array",
          "maxItems": 8,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "table_name",
              "error",
              "table_name_truncated"
            ],
            "properties": {
              "table_name": {
                "type": "string",
                "maxLength": 256
              },
              "error": {
                "type": "string",
                "maxLength": 256
              },
              "table_name_truncated": {
                "type": "boolean"
              }
            }
          }
        },
        "failure_details_truncated": {
          "type": "boolean",
          "description": "True when additional failed tables or part of a long table name or error were omitted."
        }
      }
    },
    "error": {
      "type": "string",
      "description": "Most recent retry or terminal failure reason. Retained while queued or running, including across progress checkpoints and recovery; omitted after successful completion."
    },
    "created_at_ms": {
      "type": "integer",
      "format": "int64"
    },
    "updated_at_ms": {
      "type": "integer",
      "format": "int64"
    },
    "expires_at_ms": {
      "type": "integer",
      "format": "int64",
      "description": "Unix epoch milliseconds after which this terminal job record and its idempotency key may be removed. Omitted while the job is nonterminal."
    }
  }
}