{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xhostd-com/json-schema/xhostd-com-snapshot-list-item-schema.json",
  "title": "SnapshotListItem",
  "description": "One snapshot of a channel's Postgres database.\n\n``kind`` is ``pre_deploy`` or ``nightly`` and tells the user which\nretention rule holds the row. ``deploy_id`` is null on a ``nightly``\nrow, because no deploy triggers one. ``git_sha`` is the code of the\nsame checkpoint, so a caller can ask the code download for the leg\nthat matches this one. It is null on a row from before the column.\n\n``aligned_blob`` is true when a ``ChannelBlobSnapshot`` of the same\nchannel names this row — the two legs of one checkpoint.\n``recoverable`` reports whether a restore can reach this snapshot: it\nis true while the marker's instant sits inside its instance's WAL-G\nwindow, and null (unknown) until that window has an upper bound. It\nis false outside the window, or when the marker names no instance.\n\n``restores`` lists the restores from this snapshot, newest first: the\nactive one and those of the last 30 days, which the command ledger\nkeeps (``postgres/api.py::restores_by_snapshot``). An empty list\nmeans that no restore named the snapshot in that time.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/api.xhostd.com-openapi.json#/components/schemas/SnapshotListItem",
  "properties": {
    "snapshot_id": {
      "type": "string",
      "format": "uuid",
      "title": "Snapshot Id"
    },
    "deploy_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Deploy Id"
    },
    "kind": {
      "type": "string",
      "title": "Kind"
    },
    "git_sha": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Git Sha"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "aligned_blob": {
      "type": "boolean",
      "title": "Aligned Blob"
    },
    "recoverable": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Recoverable"
    },
    "restores": {
      "items": {
        "$ref": "#/$defs/SnapshotRestoreItem"
      },
      "type": "array",
      "title": "Restores"
    }
  },
  "type": "object",
  "required": [
    "snapshot_id",
    "deploy_id",
    "kind",
    "git_sha",
    "created_at",
    "aligned_blob",
    "recoverable",
    "restores"
  ],
  "$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."
    },
    "SnapshotRestoreItem": {
      "properties": {
        "restore_id": {
          "type": "string",
          "format": "uuid",
          "title": "Restore Id"
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "extracting",
            "loading",
            "swapping",
            "succeeded",
            "failed"
          ],
          "title": "Status"
        },
        "during_restore": {
          "$ref": "#/$defs/DuringRestore"
        },
        "started_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Started At"
        },
        "swapped_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Swapped At"
        },
        "finished_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Finished At"
        }
      },
      "type": "object",
      "required": [
        "restore_id",
        "status",
        "during_restore",
        "started_at",
        "swapped_at",
        "finished_at"
      ],
      "title": "SnapshotRestoreItem",
      "description": "One restore from a snapshot, as the snapshot list carries it.\n\n``status`` and ``during_restore`` read as on the restore's status.\n``swapped_at`` is when the restored database replaced the channel's\ndatabase: the end of a ``succeeded`` restore, and null for any other."
    }
  }
}