import importlib
from collections.abc import Callable

_root_lib_path = "sinapsis_chat_history.templates"

_template_lookup = {
    "ChatHistoryFetch": f"{_root_lib_path}.chat_history_fetch",
    "ChatHistoryDelete": f"{_root_lib_path}.chat_history_delete",
    "ChatHistoryReset": f"{_root_lib_path}.chat_history_reset",
    "ChatHistorySave": f"{_root_lib_path}.chat_history_save",
    "ChatHistoryTrim": f"{_root_lib_path}.chat_history_trim",
}


def __getattr__(name: str) -> Callable:
    if name in _template_lookup:
        module = importlib.import_module(_template_lookup[name])
        return getattr(module, name)
    raise AttributeError(f"template `{name}` not found in {_root_lib_path}")


__all__ = list(_template_lookup.keys())
