"""FactorMiner: LLM-powered quantitative factor mining with evolutionary search."""

__version__ = "0.1.0"
__author__ = "FactorMiner Team"

# Core submodules (imported lazily or explicitly)
from src.factorminer.core import (
    FormulaCanonicalizer,
    ExpressionTree,
    Factor,
    FactorLibrary,
    HelixLoop,
    MiningSession,
    Node,
    RalphLoop,
    parse,
    try_parse,
)
from src.factorminer.data import (
    TensorConfig,
    build_tensor,
    load_market_data,
    preprocess,
)
from src.factorminer.evaluation import (
    FactorCombiner,
    PortfolioBacktester,
    ValidationPipeline,
    compute_ic,
    compute_icir,
    run_evaluation_pipeline,
)
from src.factorminer.operators import (
    OPERATOR_REGISTRY,
    execute_operator,
    get_operator,
    implemented_operators,
    list_operators,
)
from src.factorminer.utils.config import (
    AutoInventorConfig,
    CapacityConfig,
    CausalConfig,
    Config,
    DataConfig,
    DebateConfig,
    EvaluationConfig,
    HelixConfig,
    LLMConfig,
    MemoryConfig,
    MiningConfig,
    Phase2Config,
    RegimeConfig,
    SignificanceConfig,
    load_config,
)

try:
    from src.factorminer.agent import FactorGenerator
except Exception:  # pragma: no cover
    FactorGenerator = None

try:
    from src.factorminer.memory import ExperienceMemory
except Exception:  # pragma: no cover
    ExperienceMemory = None

try:
    from src.factorminer.benchmark import HelixBenchmark, run_benchmark_suite
except Exception:  # pragma: no cover
    HelixBenchmark = None
    run_benchmark_suite = None

__all__ = [
    "__version__",
    # config
    "Config",
    "MiningConfig",
    "EvaluationConfig",
    "DataConfig",
    "LLMConfig",
    "MemoryConfig",
    "load_config",
    "Phase2Config",
    "CausalConfig",
    "RegimeConfig",
    "CapacityConfig",
    "SignificanceConfig",
    "DebateConfig",
    "AutoInventorConfig",
    "HelixConfig",
    # core
    "Node",
    "ExpressionTree",
    "Factor",
    "FactorLibrary",
    "RalphLoop",
    "HelixLoop",
    "MiningSession",
    "parse",
    "try_parse",
    "FormulaCanonicalizer",
    # data
    "load_market_data",
    "preprocess",
    "TensorConfig",
    "build_tensor",
    # evaluation
    "compute_ic",
    "compute_icir",
    "run_evaluation_pipeline",
    "ValidationPipeline",
    "FactorCombiner",
    "PortfolioBacktester",
    # operators
    "OPERATOR_REGISTRY",
    "list_operators",
    "implemented_operators",
    "get_operator",
    "execute_operator",
    # agent
    "FactorGenerator",
    # memory
    "ExperienceMemory",
    # benchmark
    "HelixBenchmark",
    "run_benchmark_suite",
]
