"""Agent tools for trading operations.

This package provides tools for:
- Synchronization stores (sync_tools)
- Data sources and market data (datasource_tools)
- Chart data access and analysis (chart_tools)
- Technical indicators (indicator_tools)
- Shape/drawing management (shape_tools)
- Trigger system and automation (trigger_tools)
"""

# Global registries that will be set by main.py
_registry = None
_datasource_registry = None
_indicator_registry = None


def set_registry(registry):
    """Set the global SyncRegistry instance for tools to use."""
    global _registry
    _registry = registry


def set_datasource_registry(datasource_registry):
    """Set the global DataSourceRegistry instance for tools to use."""
    global _datasource_registry
    _datasource_registry = datasource_registry


def set_indicator_registry(indicator_registry):
    """Set the global IndicatorRegistry instance for tools to use."""
    global _indicator_registry
    _indicator_registry = indicator_registry


# Import all tools from submodules
from .sync_tools import SYNC_TOOLS
from .datasource_tools import DATASOURCE_TOOLS
from .chart_tools import CHART_TOOLS
from .indicator_tools import INDICATOR_TOOLS
from .research_tools import RESEARCH_TOOLS
from .shape_tools import SHAPE_TOOLS
from .trigger_tools import (
    TRIGGER_TOOLS,
    set_trigger_queue,
    set_trigger_scheduler,
    set_coordinator,
)

__all__ = [
    "set_registry",
    "set_datasource_registry",
    "set_indicator_registry",
    "set_trigger_queue",
    "set_trigger_scheduler",
    "set_coordinator",
    "SYNC_TOOLS",
    "DATASOURCE_TOOLS",
    "CHART_TOOLS",
    "INDICATOR_TOOLS",
    "RESEARCH_TOOLS",
    "SHAPE_TOOLS",
    "TRIGGER_TOOLS",
]
