from __future__ import annotations

from app.core.agent.utils.process_v2.models import V2Domain, V2Intent, V2Subintent


class V2RouteCatalog:
    _ALLOWED_ROUTES = (
        (V2Domain.DOCS, V2Intent.DOC_EXPLAIN, V2Subintent.FIND_FILES),
        (V2Domain.DOCS, V2Intent.DOC_EXPLAIN, V2Subintent.API_EXPOSED),
        (V2Domain.DOCS, V2Intent.DOC_EXPLAIN, V2Subintent.SUMMARY),
        (V2Domain.DOCS, V2Intent.DOC_UPDATE, V2Subintent.FROM_FEATURE),
        (V2Domain.GENERAL, V2Intent.GENERAL_QA, V2Subintent.SUMMARY),
    )

    def allowed_routes(self) -> list[dict[str, str]]:
        return [
            {"routing_domain": domain, "intent": intent, "subintent": subintent}
            for domain, intent, subintent in self._ALLOWED_ROUTES
        ]

    def is_allowed(self, routing_domain: str, intent: str, subintent: str) -> bool:
        return (routing_domain, intent, subintent) in self._ALLOWED_ROUTES
