"""Выбор prompt для process-local workflow v2."""

from __future__ import annotations


class V2PromptSelector:
    _DOCS_INTENT_PROMPTS = {
        "DOCUMENTATION_EXPLAIN": "documentation_explain_answer",
        "GENERAL_QA": "general_qa_answer",
    }

    def select(self, *, intent: str = "DOCUMENTATION_EXPLAIN", sub_intent: str, answer_mode: str) -> str:
        intent_key = (intent or "DOCUMENTATION_EXPLAIN").upper()
        if intent_key in {"OPENAPI_GENERATION", "OPENAPI_FROM_DOCUMENTATION"}:
            if sub_intent.upper() == "OPENAPI_FRAGMENT_GENERATE":
                return "openapi_fragment_answer"
            return "openapi_answer"
        return self._DOCS_INTENT_PROMPTS.get(intent_key, "documentation_explain_answer")
