{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://olip.ai/spec/0.2/schemas/webhook-subscription.json",
  "title": "OLIP status webhook subscription (0.2)",
  "type": "object",
  "required": [
    "olip_version",
    "subscription_id",
    "handoff_id",
    "callback_url",
    "created_at",
    "status",
    "signing"
  ],
  "properties": {
    "olip_version": {
      "const": "0.2"
    },
    "subscription_id": {
      "$ref": "https://olip.ai/spec/0.1/schemas/common.json#/$defs/id"
    },
    "handoff_id": {
      "$ref": "https://olip.ai/spec/0.1/schemas/common.json#/$defs/id"
    },
    "callback_url": {
      "type": "string",
      "maxLength": 2000
    },
    "created_at": {
      "$ref": "https://olip.ai/spec/0.1/schemas/common.json#/$defs/timestamp"
    },
    "status": {
      "enum": [
        "active",
        "cancelled",
        "failing"
      ]
    },
    "signing": {
      "type": "object",
      "required": [
        "alg",
        "kid",
        "keys_url",
        "max_clock_skew_seconds"
      ],
      "properties": {
        "alg": {
          "const": "EdDSA"
        },
        "kid": {
          "type": "string"
        },
        "keys_url": {
          "type": "string"
        },
        "max_clock_skew_seconds": {
          "const": 300
        }
      },
      "additionalProperties": false
    },
    "max_attempts": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10
    },
    "statement": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
