{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prro-cloud/json-schema/prro-cloud-webhook-delivery-schema.json",
  "title": "WebhookDelivery",
  "description": "Одна доставка події та її статус.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/prro-cloud-openapi.yaml#/components/schemas/WebhookDelivery",
  "type": "object",
  "required": [
    "id",
    "event",
    "status",
    "attempts",
    "created_at",
    "data"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Ідентифікатор доставки. Це значення вказують у шляху replay."
    },
    "event": {
      "type": "string",
      "description": "Тип події. Крім значень WebhookEvent, доставка може мати зарезервовані типи без підписки: webhook.ping (тестова доставка) і system.dps_* (події доступності ДПС)."
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "delivering",
        "delivered",
        "failed",
        "dead"
      ],
      "description": "- `pending` — доставка в черзі\n- `delivering` — спроба виконується\n- `delivered` — подію доставлено\n- `failed` — спроба невдала, сервіс виконає повторну спробу\n- `dead` — спроби закінчилися"
    },
    "attempts": {
      "type": "integer",
      "description": "Кількість виконаних спроб."
    },
    "cash_register_id": {
      "type": "string",
      "format": "uuid",
      "description": "Каса події. Поля немає для подій рівня клієнта."
    },
    "sequence": {
      "type": "integer",
      "format": "int64",
      "description": "Номер події в межах каси (поле sequence конверта). За цим номером упорядковують події. Поля немає для подій рівня клієнта."
    },
    "data": {
      "description": "Дані події (поле data конверта)."
    },
    "last_error": {
      "type": "string",
      "description": "Результат останньої невдалої спроби: код і початок відповіді приймача або причина помилки з'єднання (наприклад, TLS)."
    },
    "next_attempt_at": {
      "type": "string",
      "format": "date-time",
      "description": "Час наступної спроби. Поля немає, якщо спроб більше не буде."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Час, коли сервіс поставив подію в чергу."
    },
    "delivered_at": {
      "type": "string",
      "format": "date-time",
      "description": "Час, коли приймач повернув успішну відповідь."
    }
  }
}