{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xhostd-com/json-schema/xhostd-com-restore-submit-response-schema.json",
  "title": "RestoreSubmitResponse",
  "description": "The answer to a restore's start: its status, and the deploys the\nstart cancelled.\n\n``cancelled_deploys`` names the channel's queued deploys and rewinds\nthat the start turned ``cancelled``, oldest first\n(``deploy/dispatch.py::cancel_queued_for_restore``). A replay of the\nrequest names these, and any row the pickup fail-safe cancelled for\nthe restore (``deploy/dispatch.py::cancelled_for_restore``).",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/api.xhostd.com-openapi.json#/components/schemas/RestoreSubmitResponse",
  "properties": {
    "restore_id": {
      "type": "string",
      "format": "uuid",
      "title": "Restore Id"
    },
    "app_id": {
      "type": "string",
      "format": "uuid",
      "title": "App Id"
    },
    "channel_id": {
      "type": "string",
      "format": "uuid",
      "title": "Channel Id"
    },
    "snapshot_id": {
      "type": "string",
      "format": "uuid",
      "title": "Snapshot Id"
    },
    "during_restore": {
      "$ref": "#/$defs/DuringRestore"
    },
    "maintenance_channel_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Maintenance Channel Id"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "extracting",
        "loading",
        "swapping",
        "succeeded",
        "failed"
      ],
      "title": "Status"
    },
    "waiting": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Waiting"
    },
    "queue_ahead": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Queue Ahead"
    },
    "activity": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Activity"
    },
    "progress": {
      "anyOf": [
        {
          "$ref": "#/$defs/RestoreProgress"
        },
        {
          "type": "null"
        }
      ]
    },
    "error_code": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error Code"
    },
    "message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Message"
    },
    "notice": {
      "type": "string",
      "title": "Notice"
    },
    "submitted_at": {
      "type": "string",
      "format": "date-time",
      "title": "Submitted At"
    },
    "started_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Started At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "finished_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Finished At"
    },
    "cancelled_deploys": {
      "items": {
        "type": "string",
        "format": "uuid"
      },
      "type": "array",
      "title": "Cancelled Deploys"
    }
  },
  "type": "object",
  "required": [
    "restore_id",
    "app_id",
    "channel_id",
    "snapshot_id",
    "during_restore",
    "maintenance_channel_id",
    "status",
    "waiting",
    "queue_ahead",
    "activity",
    "progress",
    "error_code",
    "message",
    "notice",
    "submitted_at",
    "started_at",
    "updated_at",
    "finished_at",
    "cancelled_deploys"
  ],
  "$defs": {
    "DuringRestore": {
      "type": "string",
      "enum": [
        "read_only",
        "maintenance",
        "live"
      ],
      "title": "DuringRestore",
      "description": "What the channel's app can do with its database while the restore\nruns, from the claim to the swap.\n\n``read_only``: the ``hold`` step makes every new transaction of\n``r_<ch32>`` in ``ch_<ch32>`` read-only, so a write fails with\nSQLSTATE 25006 rather than vanish at the swap. ``maintenance``: the\nsame hold, and the edge serves a page in place of the app\n(``restore_dispatch.py::project_maintenance``), the restore's\n``maintenance_channel_id`` parameter naming a static channel for the\npage or ``None`` for the platform's own. ``live``: the app keeps writing, and the swap\ndiscards those writes."
    },
    "RestoreProgress": {
      "properties": {
        "phase": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Phase"
        },
        "bytes": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bytes"
        },
        "segments": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Segments"
        },
        "waiting": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Waiting"
        },
        "items_done": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Items Done"
        },
        "items_total": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Items Total"
        }
      },
      "type": "object",
      "required": [
        "phase",
        "bytes",
        "segments",
        "waiting",
        "items_done",
        "items_total"
      ],
      "title": "RestoreProgress",
      "description": "How far a restore's current step got.\n\nWhile the restore extracts, ``phase`` names the extract's phase:\n``fetch``, ``refetch``, ``replay``, or ``dump``. ``bytes`` counts the\nbytes the database server has fetched from the backup, or written to\nthe snapshot's dump, so far, and ``segments`` counts the log files\nthe ``replay`` phase has replayed. ``waiting`` names why the extract\nwaits for the database server, such as ``extraction_busy``.\n``items_done`` of ``items_total`` counts the snapshot's entries\nloaded. A field the step does not report is null."
    }
  }
}