{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/publicaml-org/json-schema/publicaml-org-chain-maintenance-schema.json",
  "title": "ChainMaintenance",
  "description": "Declared maintenance on a chain: why the graph is not moving, how far it got, and when it is expected back. The reason and the ETA are declared by an operator; `indexed_to_block` and `indexed_at` are read from the writer's own bookkeeping, so a stale ETA cannot hide a stalled writer — compare the two. A notice nobody has confirmed for three days (counted from the later of its start, its last update and its ETA) is treated as forgotten and no longer sent.\n\nSince 16.11.2026 the same block is also sent UNDECLARED, with `state: lagging`, when a graph chain's indexer has not completed a batch for longer than a threshold (15 minutes; 90 for `BTC`) and nobody has announced maintenance. Then only the facts are filled (`indexed_to_block`, `indexed_at`, `detail`); `reason`, `note`, `started_at`, `eta` and `eta_seconds` are null — a cause and an end time are declared by a person, never guessed. A declared notice takes precedence. Treat an unknown `state` like `lagging`: the graph may be behind.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/publicaml-org-openapi.json#/components/schemas/ChainMaintenance",
  "type": "object",
  "properties": {
    "state": {
      "type": "string",
      "enum": [
        "planned",
        "stopped",
        "catchup",
        "lagging"
      ],
      "description": "`planned`: announced, indexing still running. `stopped`: indexing deliberately paused, the graph is not growing. `catchup`: running again and working through the backlog. `lagging` (since 16.11.2026): NOT announced — the indexer has not completed a batch for longer than the threshold; facts only, no reason or ETA."
    },
    "reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Short slug, e.g. `linkep-resharding`. null with `state: lagging`."
    },
    "note": {
      "type": [
        "string",
        "null"
      ],
      "description": "What is being done, in one or two sentences. null with `state: lagging`."
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the maintenance was declared to start. null with `state: lagging` (read `indexed_at`)."
    },
    "eta": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the chain is expected to be current again. `null` means the duration is genuinely unknown — we do not invent one."
    },
    "eta_seconds": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Seconds left against `eta`, clamped at 0 once the ETA has passed."
    },
    "indexed_to_block": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The graph is complete up to this block on this chain."
    },
    "indexed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the writer last completed a batch. Read it next to `eta`: a future ETA with a stale `indexed_at` means the window has slipped."
    },
    "detail": {
      "type": "string",
      "description": "The same facts as one English sentence, safe to show a user."
    }
  }
}