"""
Surrogate Models
================

Neural network and ML surrogate models for FEA acceleration.

Available modules:
- neural_surrogate: AtomizerField neural network surrogate
- generic_surrogate: Flexible surrogate interface
- adaptive_surrogate: Self-improving surrogate
- simple_mlp_surrogate: Simple multi-layer perceptron
- active_learning_surrogate: Active learning surrogate
- surrogate_tuner: Hyperparameter tuning
- auto_trainer: Automatic model training
- training_data_exporter: Export training data from studies

Note: Imports are done on-demand to avoid import errors from optional dependencies.
"""

# Lazy imports to avoid circular dependencies and optional dependency issues
def __getattr__(name):
    """Lazy import mechanism for surrogate modules."""
    if name == 'NeuralSurrogate':
        from .neural_surrogate import NeuralSurrogate
        return NeuralSurrogate
    elif name == 'create_surrogate_for_study':
        from .neural_surrogate import create_surrogate_for_study
        return create_surrogate_for_study
    elif name == 'GenericSurrogate':
        from .generic_surrogate import GenericSurrogate
        return GenericSurrogate
    elif name == 'ConfigDrivenSurrogate':
        from .generic_surrogate import ConfigDrivenSurrogate
        return ConfigDrivenSurrogate
    elif name == 'create_surrogate':
        from .generic_surrogate import create_surrogate
        return create_surrogate
    elif name == 'AdaptiveSurrogate':
        from .adaptive_surrogate import AdaptiveSurrogate
        return AdaptiveSurrogate
    elif name == 'SimpleSurrogate':
        from .simple_mlp_surrogate import SimpleSurrogate
        return SimpleSurrogate
    elif name == 'ActiveLearningSurrogate':
        from .active_learning_surrogate import ActiveLearningSurrogate
        return ActiveLearningSurrogate
    elif name == 'SurrogateHyperparameterTuner':
        from .surrogate_tuner import SurrogateHyperparameterTuner
        return SurrogateHyperparameterTuner
    elif name == 'tune_surrogate_for_study':
        from .surrogate_tuner import tune_surrogate_for_study
        return tune_surrogate_for_study
    elif name == 'AutoTrainer':
        from .auto_trainer import AutoTrainer
        return AutoTrainer
    elif name == 'TrainingDataExporter':
        from .training_data_exporter import TrainingDataExporter
        return TrainingDataExporter
    elif name == 'create_exporter_from_config':
        from .training_data_exporter import create_exporter_from_config
        return create_exporter_from_config

    raise AttributeError(f"module 'optimization_engine.processors.surrogates' has no attribute '{name}'")

__all__ = [
    'NeuralSurrogate',
    'create_surrogate_for_study',
    'GenericSurrogate',
    'ConfigDrivenSurrogate',
    'create_surrogate',
    'AdaptiveSurrogate',
    'SimpleSurrogate',
    'ActiveLearningSurrogate',
    'SurrogateHyperparameterTuner',
    'tune_surrogate_for_study',
    'AutoTrainer',
    'TrainingDataExporter',
    'create_exporter_from_config',
]
