{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/guestgraph-io/json-schema/guestgraph-io-subscription-removed-schema.json",
  "title": "SubscriptionRemoved",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/guestgraph-io-apaleo-openapi.yml#/components/schemas/SubscriptionRemoved",
  "allOf": [
    {
      "$ref": "#/$defs/SubscriptionState"
    },
    {
      "type": "object",
      "required": [
        "removed"
      ],
      "properties": {
        "removed": {
          "description": "Whether this request deleted a subscription. False means there was none to delete, which is success: the end state asked for is the end state now.\n",
          "type": "boolean"
        },
        "endpoint": {
          "description": "The endpoint URL the removed subscription pointed at, so an operator taking away a stale one can see which address it was.\n",
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  ],
  "$defs": {
    "SubscriptionState": {
      "type": "object",
      "required": [
        "state",
        "eventTypes"
      ],
      "properties": {
        "state": {
          "description": "ACTIVE when Apaleo holds a subscription for this connection; REMOVED when an operator asked for none; MISSING when there is none and nobody asked, which is a fault; UNKNOWN before the first read.\n",
          "type": "string",
          "enum": [
            "ACTIVE",
            "MISSING",
            "REMOVED",
            "UNKNOWN"
          ]
        },
        "id": {
          "description": "Apaleo's id for the subscription, when there is one",
          "type": [
            "string",
            "null"
          ]
        },
        "eventTypes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "checkedAt": {
          "description": "When this was last read from or written to Apaleo",
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}