{
  "openapi": "3.1.0",
  "info": {
    "title": "SocialDancer public API",
    "version": "1.0.0",
    "description": "Публичные endpoint'ы лендинга socialdancer.ru и машиночитаемый контекст для ИИ-агентов.",
    "contact": { "email": "socialdancer@mail.ru" }
  },
  "servers": [{ "url": "https://socialdancer.ru", "description": "Production" }],
  "paths": {
    "/api/public/ai/context": {
      "get": {
        "operationId": "getAiContext",
        "summary": "Машиночитаемое описание сервиса для агентов",
        "description": "Возвращает направления танцев, роли, уровни, цели поиска, шаги работы сервиса и контакты.",
        "responses": {
          "200": {
            "description": "Контекст сервиса",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AiContext" } } }
          }
        }
      }
    },
    "/api/public/register": {
      "post": {
        "operationId": "registerLead",
        "summary": "Заявка на доступ (закрытый бета-доступ)",
        "description": "Требует согласия на обработку персональных данных (privacy=1). Вызывать только по явной просьбе пользователя.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "email", "privacy"],
                "properties": {
                  "name": { "type": "string", "maxLength": 100 },
                  "email": { "type": "string", "format": "email" },
                  "phone": { "type": "string", "description": "Необязательно" },
                  "privacy": { "type": "integer", "enum": [1], "description": "Согласие по 152-ФЗ" },
                  "privacy_version": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Заявка принята", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Success" } } } },
          "400": { "description": "Ошибка валидации", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "description": "Слишком много запросов" }
        }
      }
    },
    "/api/public/contact": {
      "post": {
        "operationId": "contactSupport",
        "summary": "Сообщение в поддержку",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "email", "message", "privacy"],
                "properties": {
                  "name": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "phone": { "type": "string" },
                  "message": { "type": "string", "maxLength": 2000 },
                  "privacy": { "type": "integer", "enum": [1] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Сообщение отправлено", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Success" } } } },
          "400": { "description": "Ошибка валидации" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Success": { "type": "object", "properties": { "success": { "type": "boolean" }, "message": { "type": "string" } } },
      "Error": { "type": "object", "properties": { "success": { "type": "boolean" }, "message": { "type": "string" } } },
      "AiContext": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "description": { "type": "string" },
          "status": { "type": "string" },
          "styles": { "type": "array", "items": { "type": "string" } },
          "roles": { "type": "array", "items": { "type": "string" } },
          "levels": { "type": "array", "items": { "type": "string" } },
          "goals": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } } } },
          "how_it_works": { "type": "array", "items": { "type": "string" } },
          "links": { "type": "object", "additionalProperties": { "type": "string" } },
          "contact": { "type": "string" }
        }
      }
    }
  }
}
