defaults:
  runner: runtime
  mode: full_chain
  input:
    rag_session_id: "fb7e0690-e737-44ca-acc6-e38a0687a5ee"

cases:
  # ============================================================
  # DOCUMENTATION_EXPLAIN / SYSTEM_FLOW_EXPLAIN
  # ============================================================
  - id: docs-v2-system-flow-telegram-loop
    query: "Объясни как работает цикл отправки уведомлений в Telegram"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: SYSTEM_FLOW_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["logic.telegram_notification_loop"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["TelegramNotifyWorker", "интервал", "degraded"]
        answer_mode: answered

  - id: docs-v2-system-flow-health-check
    query: "Как происходит получение health состояния runtime?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: SYSTEM_FLOW_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.health_endpoint", "domain.runtime_health"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D4_WORKFLOW_INDEX", "D5_RELATION_GRAPH", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["/health", "HTTP 200", "HTTP 503", "payload"]
        answer_mode: answered

  # ============================================================
  # DOCUMENTATION_EXPLAIN / COMPONENT_EXPLAIN
  # ============================================================
  - id: docs-v2-component-control-channel
    query: "Объясни как работает компонент TelegramControlChannel"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: COMPONENT_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        entity_candidates_contain: ["TelegramControlChannel"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D5_RELATION_GRAPH", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["/health", "/actions/{action}", "/send"]
        answer_mode: answered

  - id: docs-v2-component-runtime-manager
    query: "Какую роль в системе играет RuntimeManager?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: COMPONENT_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        entity_candidates_contain: ["RuntimeManager"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D5_RELATION_GRAPH", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["runtime", "регистр", "TelegramNotifyModule"]
        answer_mode: answered

  # ============================================================
  # DOCUMENTATION_EXPLAIN / API_METHOD_EXPLAIN
  # ============================================================
  - id: docs-v2-api-health-endpoint
    query: "Объясни что делает endpoint /health"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: API_METHOD_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.health_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["HTTP 200", "HTTP 503", "payload", "components"]
        answer_mode: answered

  - id: docs-v2-api-send-endpoint
    query: "Как работает endpoint /send?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: API_METHOD_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.send_message_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D4_WORKFLOW_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["message", "HTTP 400", "HTTP 500", "TelegramSendService"]
        answer_mode: answered

  # ============================================================
  # DOCUMENTATION_EXPLAIN / ENTITY_EXPLAIN
  # ============================================================
  - id: docs-v2-entity-runtime-health
    query: "Что такое runtime health?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: ENTITY_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["domain.runtime_health"]
        layers_include: ["D3_ENTITY_CATALOG", "D1_DOCUMENT_CATALOG", "D5_RELATION_GRAPH", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["наблюдаемости", "WorkerHealth", "WorkerStatus", "telegram_notify"]
        answer_mode: answered

  - id: docs-v2-entity-worker-status
    query: "Объясни сущность WorkerStatus"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: ENTITY_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        entity_candidates_contain: ["WorkerStatus"]
        layers_include: ["D3_ENTITY_CATALOG", "D1_DOCUMENT_CATALOG", "D5_RELATION_GRAPH", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["ok", "degraded", "unhealthy"]
        answer_mode: answered

  # ============================================================
  # DOCUMENTATION_EXPLAIN / RELATED_DOCS_EXPLAIN
  # ============================================================
  - id: docs-v2-related-docs-health
    query: "Какие документы связаны с endpoint /health?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.health_endpoint"]
        layers_include: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["domain.runtime_health", "architecture.telegram_notify_app"]
        answer_mode: answered

  - id: docs-v2-related-docs-architecture-overview
    query: "Какие дочерние документы есть у overview архитектуры сервиса?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: RELATED_DOCS_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["architecture.telegram_notify_app"]
        layers_include: ["D5_RELATION_GRAPH", "D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["api.health_endpoint", "api.send_message_endpoint", "logic.telegram_notification_loop"]
        answer_mode: answered

  # ============================================================
  # OPENAPI_GENERATION / OPENAPI_METHOD_GENERATE
  # ============================================================
  - id: docs-v2-openapi-health
    query: "Сгенерируй OpenAPI для endpoint /health по документации"
    expected:
      router:
        intent: OPENAPI_GENERATION
        sub_intent: OPENAPI_METHOD_GENERATE
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.health_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["paths:", "/health", "get:"]
        answer_mode: structured_spec

  # ============================================================
  # OPENAPI_GENERATION / OPENAPI_FRAGMENT_GENERATE
  # ============================================================
  - id: docs-v2-openapi-fragment-send-request
    query: "Сгенерируй request schema для endpoint /send"
    expected:
      router:
        intent: OPENAPI_GENERATION
        sub_intent: OPENAPI_FRAGMENT_GENERATE
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        doc_scope_contains: ["api.send_message_endpoint"]
        layers_include: ["D1_DOCUMENT_CATALOG", "D2_FACT_INDEX", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["message", "string"]
        answer_mode: structured_spec

  # ============================================================
  # GENERAL_QA / GENERIC_QA
  # ============================================================
  - id: docs-v2-general-overview
    query: "Что вообще описано в документации по этому сервису?"
    expected:
      router:
        intent: GENERAL_QA
        sub_intent: GENERIC_QA
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: true
        layers_include: ["D1_DOCUMENT_CATALOG", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["архитектура", "API", "worker", "runtime"]
        answer_mode: answered

  # ============================================================
  # NEGATIVE / DEGRADED
  # ============================================================
  - id: docs-v2-negative-missing-entity
    query: "Что такое сущность PaymentTransaction?"
    expected:
      router:
        intent: DOCUMENTATION_EXPLAIN
        sub_intent: ENTITY_EXPLAIN
        graph_id: DocsQAGraph
        conversation_mode: START
      retrieval:
        non_empty: false
        entity_candidates_contain: ["PaymentTransaction"]
        layers_include: ["D3_ENTITY_CATALOG", "D1_DOCUMENT_CATALOG", "D5_RELATION_GRAPH", "D0_DOC_CHUNKS"]
      llm:
        non_empty: true
        contains_any: ["не найдена", "нет в документации"]
      pipeline:
        answer_mode: degraded