{
  "openapi": "3.1.0",
  "info": {
    "title": "CHECKER AGENT API",
    "version": "1.0.0",
    "description": "Проверка совета нейросети перед покупкой и справочники замеров ассистентов. Бесплатно, без ключа, 5 проверок в сутки с одного IP. Ответ — факты, а не вердикт.",
    "contact": { "name": "ООО «САРМАТЕХ»", "email": "info@a2aprotocol.ru", "url": "https://checkeragent.ru/o-proekte/" },
    "license": { "name": "CC BY 4.0", "url": "https://creativecommons.org/licenses/by/4.0/" }
  },
  "servers": [{ "url": "https://checkeragent.ru/api/v1" }],
  "paths": {
    "/check": {
      "post": {
        "summary": "Проверить ответ ассистента о покупке",
        "operationId": "createCheck",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": { "type": "string", "maxLength": 4000, "description": "Ответ ассистента целиком (от 20 символов)" },
                  "question": { "type": "string", "maxLength": 300, "description": "Вопрос покупателя. Если text пуст — агент получает ответ поиска Яндекса через API (если подключён)" },
                  "assistant": { "type": "string", "enum": ["alisa", "gigachat", "chatgpt", "ozon", "wb", "other", ""] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Разбор", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Check" } } } },
          "422": { "description": "Пустой или слишком короткий текст" },
          "429": { "description": "Лимит 5 проверок в сутки с одного IP" }
        }
      }
    },
    "/check/{id}": {
      "get": {
        "summary": "Получить разбор по id (30 дней)",
        "operationId": "getCheck",
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[a-f0-9]{12}$" } }],
        "responses": { "200": { "description": "Разбор", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Check" } } } }, "404": { "description": "Нет или истёк" } }
      }
    },
    "/assistants": { "get": { "summary": "Ассистенты, которые замеряются", "operationId": "listAssistants", "responses": { "200": { "description": "Список" } } } },
    "/questions": { "get": { "summary": "Банк из 50 вопросов замера", "operationId": "listQuestions", "responses": { "200": { "description": "Список" } } } },
    "/methodology": { "get": { "summary": "Критерии К1–К7 и правила", "operationId": "getMethodology", "responses": { "200": { "description": "Методика" } } } },
    "/waves": { "get": { "summary": "Волны замеров (пока пусто, первая — 27.11.2026)", "operationId": "listWaves", "responses": { "200": { "description": "Список" } } } }
  },
  "components": {
    "schemas": {
      "Check": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "created": { "type": "string", "format": "date-time" },
          "mode": { "type": "string", "enum": ["text", "question"] },
          "assistant": { "type": "string" },
          "findings": { "type": "array", "items": { "type": "object", "properties": { "level": { "type": "string", "enum": ["attention", "ok", "info"] }, "title": { "type": "string" }, "detail": { "type": "string" } } } },
          "items": { "type": "array", "items": { "type": "string" } },
          "shops": { "type": "array", "items": { "type": "string" } },
          "links": { "type": "array", "items": { "type": "string" } },
          "other_sellers": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "host": { "type": "string" }, "url": { "type": "string" }, "title": { "type": "string" } } } },
          "notes": { "type": "array", "items": { "type": "string" } },
          "expires_days": { "type": "integer" }
        }
      }
    }
  }
}
