{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peppolstatus-com/json-schema/peppolstatus-com-incident-page-schema.json",
  "title": "IncidentPage",
  "description": "A page of incidents.",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peppolstatus-com-incidents-api-openapi.yml#/components/schemas/IncidentPage",
  "type": "object",
  "required": [
    "items",
    "next_cursor"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/IncidentView"
      }
    },
    "next_cursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Opaque cursor for the next page, or null on the last page."
    }
  },
  "$defs": {
    "HostRole": {
      "type": "string",
      "enum": [
        "SMP",
        "AP"
      ]
    },
    "IncidentTimelineStep": {
      "type": "object",
      "required": [
        "at",
        "severity"
      ],
      "properties": {
        "at": {
          "type": "string",
          "format": "date-time"
        },
        "severity": {
          "type": "string",
          "enum": [
            "up",
            "degraded",
            "down"
          ]
        }
      }
    },
    "IncidentView": {
      "type": "object",
      "required": [
        "id",
        "hostname",
        "role",
        "status",
        "severity",
        "started_at",
        "ended_at",
        "timeline"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "hostname": {
          "type": "string"
        },
        "role": {
          "$ref": "#/$defs/HostRole"
        },
        "status": {
          "type": "string",
          "enum": [
            "open",
            "closed"
          ]
        },
        "severity": {
          "type": "string",
          "enum": [
            "up",
            "degraded",
            "down"
          ]
        },
        "started_at": {
          "type": "string",
          "format": "date-time"
        },
        "ended_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "timeline": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IncidentTimelineStep"
          }
        },
        "kind": {
          "type": "string",
          "enum": [
            "quorum",
            "partial"
          ],
          "description": "Incident kind (audit finding #39). 'quorum' is a network-wide incident (>= half the healthy probe locations agreed non-up); 'partial' is a single-location sustained outage that never formed quorum. Absent on pre-#39 payloads means 'quorum'."
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "description": "The affected probe location on a 'partial' incident; null otherwise."
        }
      }
    }
  }
}