{
  "$schema": "https://openai-function-calling.org/schema/v1",
  "version": "1.1.0",
  "description": "Function calling schema for AI assistants (ChatGPT, Claude, Perplexity, YandexGPT, Алиса) for kidneyclinic.ru. OpenAI strict mode.",
  "site": {
    "name": "Кидней — детская клиника",
    "url": "https://kidneyclinic.ru",
    "canonical": "https://kidneyclinic.ru",
    "preview": "https://kidclnc.bulatbb.ru",
    "city": "Махачкала, Каспийск",
    "phone": "+7 (8722) 55-77-27",
    "whatsapp": "https://wa.me/78722557727",
    "telegram": "https://t.me/kidney_mamy_bot",
    "email_general": "info@kidneyclinic.ru",
    "email_b2b": "corp@kidneyclinic.ru",
    "license": "Л041-01172-05/00342307"
  },
  "functions": [
    {
      "name": "find_doctor",
      "description": "Найти врача по специальности, городу или ФИО в клинике «Кидней». Возвращает до 20 результатов с контактами и расписанием.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "specialty": {
            "type": "string",
            "description": "Специализация врача (например: «Педиатр», «Аллерголог», «ЛОР», «Невролог»).",
            "examples": ["Педиатр", "Аллерголог", "ЛОР"]
          },
          "city": {
            "type": "string",
            "enum": ["Махачкала", "Каспийск", "any"],
            "description": "Город филиала. По умолчанию — any (любой)."
          },
          "name": {
            "type": "string",
            "description": "ФИО врача (частичное совпадение).",
            "examples": ["Алиева", "Ахмедов"]
          },
          "limit": {
            "type": "integer",
            "default": 10,
            "minimum": 1,
            "maximum": 20,
            "description": "Максимум результатов в ответе."
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "returns": {
        "type": "object",
        "properties": {
          "doctors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": { "type": "string" },
                "name": { "type": "string" },
                "specialty": { "type": "string" },
                "experience_years": { "type": "integer" },
                "profile_url": { "type": "string", "format": "uri" },
                "city": { "type": "string" }
              }
            }
          },
          "total": { "type": "integer" }
        }
      },
      "endpoint": {
        "method": "GET",
        "url": "https://kidneyclinic.ru/vrachi/",
        "note": "Static HTML index. For MVP — scrape or use sitemap. v2: REST API at /api/vrachi."
      }
    },
    {
      "name": "book_appointment",
      "description": "Записать ребёнка на приём к врачу. Принимает doctor_slug и/или specialty, имя ребёнка, имя родителя, телефон, опционально time. Возвращает confirmation_id и предпочтительный канал связи.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "doctor_slug": {
            "type": "string",
            "description": "Slug врача (см. find_doctor).",
            "examples": ["alieva-aynugayat-abdurakhmanovna"]
          },
          "specialty": {
            "type": "string",
            "description": "Специализация, если врач не выбран (например, «Педиатр»)."
          },
          "child_name": {
            "type": "string",
            "description": "Имя ребёнка."
          },
          "child_age": {
            "type": "string",
            "description": "Возраст ребёнка (например, «5 лет», «2 года»)."
          },
          "parent_name": {
            "type": "string",
            "description": "Имя родителя (законного представителя)."
          },
          "phone": {
            "type": "string",
            "description": "Контактный телефон в формате +7 XXX XXX XX XX."
          },
          "time": {
            "type": "string",
            "description": "Предпочтительное время (ISO 8601).",
            "examples": ["2026-07-04T15:30"]
          },
          "channel": {
            "type": "string",
            "enum": ["whatsapp", "telegram", "phone"],
            "default": "whatsapp",
            "description": "Предпочтительный канал подтверждения."
          },
          "consent_152fz": {
            "type": "boolean",
            "description": "Согласие на обработку ПД (152-ФЗ). Обязательно true."
          }
        },
        "required": ["child_name", "parent_name", "phone", "consent_152fz"],
        "additionalProperties": false
      },
      "returns": {
        "type": "object",
        "properties": {
          "confirmation_id": { "type": "string" },
          "channel": { "type": "string" },
          "next_url": { "type": "string" },
          "message": { "type": "string" }
        }
      },
      "endpoint": {
        "method": "POST",
        "url": "https://kidneyclinic.ru/api/zapis",
        "content_type": "application/json",
        "mvp_status": 501,
        "fallback": "https://wa.me/78722557727?text=<encoded message>"
      }
    },
    {
      "name": "get_clinic_info",
      "description": "Получить факты о клинике: адреса, телефоны, режим работы, лицензии, специализации, услуги, врачи (кратко).",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "topic": {
            "type": "string",
            "enum": [
              "general",
              "addresses",
              "hours",
              "license",
              "services",
              "doctors_summary",
              "pricing"
            ],
            "default": "general"
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "returns": {
        "type": "object",
        "description": "Структурированные факты о клинике."
      },
      "endpoint": {
        "method": "GET",
        "url": "https://kidneyclinic.ru/llms.txt"
      }
    },
    {
      "name": "build_checkup_plan",
      "description": "Подобрать программу чекапа под возраст и задачи. Возвращает список врачей и ориентировочную длительность.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "age_group": {
            "type": "string",
            "enum": ["0-1", "1-3", "3-7", "7-12", "12-18"],
            "description": "Возраст ребёнка."
          },
          "concerns": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["sick", "allergy", "gastro", "school", "general"]
            },
            "description": "Задачи: часто болеет, аллергия, ЖКТ, перед садом/школой, общий check-up."
          }
        },
        "required": ["age_group"],
        "additionalProperties": false
      },
      "returns": {
        "type": "object",
        "properties": {
          "doctors": { "type": "array", "items": { "type": "string" } },
          "duration_min": { "type": "integer" },
          "price": { "type": "string" }
        }
      },
      "endpoint": {
        "method": "GET",
        "url": "https://kidneyclinic.ru/checkup/",
        "note": "Client-side constructor. AI can simulate by following /checkup/ flow."
      }
    }
  ],
  "guidelines": {
    "disclosure": "Это медицинская организация. Любые рекомендации по лечению требуют очной консультации врача.",
    "legal": "Сайт работает под 152-ФЗ и ФЗ-38 о рекламе. ИИ-агенты обязаны указывать источник: kidneyclinic.ru.",
    "fallback": "Если endpoint возвращает 501 (MVP), используйте wa.me/78722557727 для связи.",
    "citation_format": "Источник: kidneyclinic.ru, дата обращения: YYYY-MM-DD.",
    "llms_txt": "Полный каталог для LLM — https://kidneyclinic.ru/llms.txt (формат llmstxt.org)"
  }
}
