"""Trainer implementations split by model type."""
from __future__ import annotations

from importlib import import_module

_LAZY_IMPORTS = {
    "TrainerBase": ("ins_pricing.modelling.bayesopt.trainers.trainer_base", "TrainerBase"),
    "TrainerContext": ("ins_pricing.modelling.bayesopt.trainers.trainer_context", "TrainerContext"),
    "FTTrainer": ("ins_pricing.modelling.bayesopt.trainers.trainer_ft", "FTTrainer"),
    "GLMTrainer": ("ins_pricing.modelling.bayesopt.trainers.trainer_glm", "GLMTrainer"),
    "GNNTrainer": ("ins_pricing.modelling.bayesopt.trainers.trainer_gnn", "GNNTrainer"),
    "ResNetTrainer": ("ins_pricing.modelling.bayesopt.trainers.trainer_resn", "ResNetTrainer"),
    "XGBTrainer": ("ins_pricing.modelling.bayesopt.trainers.trainer_xgb", "XGBTrainer"),
    "_xgb_cuda_available": ("ins_pricing.modelling.bayesopt.trainers.trainer_xgb", "_xgb_cuda_available"),
}


def __getattr__(name: str):
    target = _LAZY_IMPORTS.get(name)
    if target is None:
        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
    module_name, attr_name = target
    value = getattr(import_module(module_name), attr_name)
    globals()[name] = value
    return value


def __dir__():
    return sorted(list(globals().keys()) + list(_LAZY_IMPORTS.keys()))


__all__ = list(_LAZY_IMPORTS.keys())
