{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/philidor-io/json-schema/philidor-io-status-response-schema.json",
  "title": "StatusResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/philidor-io-system-api-openapi.yml#/components/schemas/StatusResponse",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "status": {
          "$ref": "#/$defs/PlatformStatus"
        },
        "rollup": {
          "allOf": [
            {
              "$ref": "#/$defs/PlatformStatus"
            },
            {
              "description": "The worst status across every component row, including the event stream, webhooks and data freshness."
            }
          ]
        },
        "last_checked_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Timestamp of the latest SLA heartbeat, or null when no heartbeat exists."
        },
        "uptime": {
          "type": "object",
          "properties": {
            "24h": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "Rolling 24-hour uptime percentage when enough heartbeat history exists."
            },
            "30d": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "Rolling 30-day uptime percentage when enough heartbeat history exists."
            },
            "90d": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "Rolling 90-day uptime percentage when enough heartbeat history exists."
            }
          },
          "description": "Rolling uptime percentages computed with the same MUP interval math used for SLA reports. Keys are omitted when the window does not have enough history."
        },
        "components": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "api (loopback heartbeat), reachability (off-box probe), errors (5xx rate over 15 min), events_stream, webhooks, data_freshness."
              },
              "status": {
                "$ref": "#/$defs/PlatformStatus"
              },
              "detail": {
                "type": "string"
              },
              "checked_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            },
            "required": [
              "name",
              "status",
              "detail",
              "checked_at"
            ]
          },
          "description": "Per-component health. `status` rolls up the first three rows; `rollup` rolls up all of them."
        },
        "signals": {
          "type": "object",
          "properties": {
            "error_rate_15m": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "requests_15m": {
              "type": "integer",
              "minimum": 0
            },
            "external_down_samples": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "error_rate_15m",
            "requests_15m",
            "external_down_samples"
          ],
          "description": "The raw inputs behind the component rows."
        }
      },
      "required": [
        "status",
        "rollup",
        "last_checked_at",
        "uptime",
        "components",
        "signals"
      ]
    }
  },
  "required": [
    "data"
  ],
  "$defs": {
    "PlatformStatus": {
      "type": "string",
      "enum": [
        "operational",
        "degraded",
        "down"
      ],
      "description": "Platform health: the worst of the api (loopback heartbeat), reachability (off-box probe) and errors (5xx rate) components. Delivery-surface rows do not move this field; see `rollup`."
    }
  }
}