"""Context protocols for the DOC_EXPLAIN/API_EXPOSED workflow."""

from __future__ import annotations

from typing import Protocol

from app.core.agent.runtime.execution_context import RuntimeExecutionContext
from app.core.agent.utils.process_v2.models import V2RouteResult
from app.core.rag.retrieval.session_retriever import RetrievalPlan


class RetrievalWorkflowContext(Protocol):
    runtime: RuntimeExecutionContext
    route: V2RouteResult
    rag_session_id: str
    retrieval_plan: RetrievalPlan | None
    retrieved_rows: list[dict]
    answer: str
    answer_generated_payload: dict[str, object] | None


class ApiWorkflowContext(RetrievalWorkflowContext, Protocol):
    endpoints: list[str]

