from __future__ import annotations


class CodeQaPromptSelector:
    _PROMPTS = {
        "ARCHITECTURE": "code_qa_architecture_answer",
        "EXPLAIN": "code_qa_explain_answer",
        "EXPLAIN_LOCAL": "code_qa_explain_local_answer",
        "FIND_ENTRYPOINTS": "code_qa_find_entrypoints_answer",
        "FIND_TESTS": "code_qa_find_tests_answer",
        "GENERAL_QA": "code_qa_general_answer",
        "OPEN_FILE": "code_qa_open_file_answer",
        "TRACE_FLOW": "code_qa_trace_flow_answer",
    }

    def select(self, *, sub_intent: str, answer_mode: str) -> str:
        if answer_mode in {"degraded", "not_found", "insufficient"}:
            return "code_qa_degraded_answer"
        return self._PROMPTS.get(sub_intent.upper(), "code_qa_explain_answer")
