{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rewio-ru/json-schema/rewio-ru-complaint-v3-schema.json",
  "title": "ComplaintV3",
  "description": "Жалоба на отзыв.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rewio-ru-openapi.json#/components/schemas/ComplaintV3",
  "properties": {
    "id": {
      "type": "integer",
      "title": "Id",
      "description": "Идентификатор жалобы."
    },
    "review_id": {
      "type": "integer",
      "title": "Review Id",
      "description": "Отзыв, на который она подана."
    },
    "status": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "pending",
            "accepted",
            "rejected",
            "failed"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Status",
      "description": "`null` – отправляется на площадку; `pending` – на рассмотрении; `accepted` – отзыв удалён; `rejected` – отзыв остался (2ГИС отметил жалобу рассмотренной или молчит 14 дней, у Яндекса прошло 7 дней, у Google – 5); `failed` – не подана, причина в `error`."
    },
    "origin": {
      "type": "string",
      "enum": [
        "rewio",
        "platform"
      ],
      "title": "Origin",
      "description": "`rewio` – подана через Rewio; `platform` – подана в кабинете площадки, мы нашли её там."
    },
    "category": {
      "anyOf": [
        {
          "$ref": "#/$defs/ComplaintCategoryV3"
        },
        {
          "type": "null"
        }
      ],
      "description": "Категория, если площадка их спрашивает."
    },
    "text": {
      "type": "string",
      "title": "Text",
      "description": "Текст жалобы. Пустой там, где площадка текста не принимает (Google)."
    },
    "author": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Author",
      "description": "Кто подал, как его называет площадка (`origin = platform`)."
    },
    "submitted_at": {
      "type": "string",
      "format": "date-time",
      "title": "Submitted At",
      "description": "Когда подана (UTC, ISO 8601)."
    },
    "resolved_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolved At",
      "description": "Когда стал известен итог – `accepted` или `rejected` (UTC, ISO 8601)."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At",
      "description": "Когда запись менялась в последний раз (UTC, ISO 8601)."
    },
    "error": {
      "anyOf": [
        {
          "$ref": "#/$defs/ComplaintErrorV3"
        },
        {
          "type": "null"
        }
      ],
      "description": "Почему не подана (`status = failed`)."
    }
  },
  "type": "object",
  "required": [
    "id",
    "review_id",
    "origin",
    "text",
    "submitted_at",
    "updated_at"
  ],
  "$defs": {
    "ComplaintCategoryV3": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code",
          "description": "Код, который передаётся в `category`."
        },
        "label": {
          "type": "string",
          "title": "Label",
          "description": "Как категорию называет площадка."
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description",
          "description": "Что она значит."
        }
      },
      "type": "object",
      "required": [
        "code",
        "label"
      ],
      "title": "ComplaintCategoryV3",
      "description": "Категория жалобы – словами площадки."
    },
    "ComplaintErrorV3": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code",
          "description": "Машинный код: `complaint_already_filed` – на отзыв уже подана жалоба (Яндекс принимает одну); `complaint_requires_upgrade`, `complaint_trial_quota_exhausted` – тариф; `complaint_access_missing`, `complaint_access_revoked`, `complaint_card_not_yours` – карточка не подключена; `complaint_not_replyable` – отзыв удалён или пришёл с другой площадки; `complaint_target_unresolved` – отзыв не нашли на площадке; `complaint_not_supported` – на площадке жалобы не подаются; `complaint_source_paused` – подача на площадке приостановлена; `complaint_rejected_by_platform` – площадка не приняла жалобу; `complaint_session_expired`, `complaint_rate_limited`, `complaint_transport_failed` – не удалось за сутки."
        },
        "message": {
          "type": "string",
          "title": "Message",
          "description": "Пояснение для человека.",
          "default": ""
        }
      },
      "type": "object",
      "required": [
        "code"
      ],
      "title": "ComplaintErrorV3",
      "description": "Почему жалоба не подана."
    }
  }
}