{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rewio-ru/json-schema/rewio-ru-webhook-v3-schema.json",
  "title": "WebhookV3",
  "description": "Подписка на события.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rewio-ru-webhooks-api-openapi.yml#/components/schemas/WebhookV3",
  "properties": {
    "id": {
      "type": "integer",
      "title": "Id",
      "description": "Идентификатор подписки."
    },
    "target": {
      "type": "string",
      "title": "Target",
      "description": "Адрес доставки."
    },
    "object_ids": {
      "anyOf": [
        {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Object Ids",
      "description": "Объекты, по которым приходят события. `null` – по всем."
    },
    "event_types": {
      "items": {
        "type": "string",
        "enum": [
          "reviews.new",
          "replies.new",
          "scrape.run.finished"
        ]
      },
      "type": "array",
      "title": "Event Types",
      "description": "События подписки."
    },
    "bucket_window": {
      "type": "string",
      "title": "Bucket Window",
      "description": "Окно группировки событий в одну доставку."
    },
    "filters": {
      "$ref": "#/$defs/FiltersV2",
      "description": "Фильтры выдачи событий."
    },
    "is_active": {
      "type": "boolean",
      "title": "Is Active",
      "description": "Включена ли подписка."
    },
    "failure_count": {
      "type": "integer",
      "title": "Failure Count",
      "description": "Сколько неудачных доставок подряд."
    },
    "last_failure_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Failure At",
      "description": "Момент последней неудачи (UTC, ISO 8601)."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "Момент создания подписки (UTC, ISO 8601)."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At",
      "description": "Момент последнего изменения (UTC, ISO 8601)."
    }
  },
  "type": "object",
  "required": [
    "id",
    "target",
    "event_types",
    "bucket_window",
    "filters",
    "is_active",
    "failure_count",
    "created_at",
    "updated_at"
  ],
  "$defs": {
    "FiltersV2": {
      "properties": {
        "allowed_ratings": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Allowed Ratings"
        },
        "allowed_sources": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Allowed Sources"
        },
        "has_text": {
          "type": "boolean",
          "title": "Has Text",
          "default": false
        },
        "has_images": {
          "type": "boolean",
          "title": "Has Images",
          "default": false
        }
      },
      "type": "object",
      "title": "FiltersV2",
      "description": "Фильтры доставки; условия объединяются по AND."
    }
  }
}