"""
策略注册器模块

提供策略注册和查找功能。
"""
from typing import Dict, Optional, TYPE_CHECKING

if TYPE_CHECKING:
    from .strategy import BaseSyncStrategy


class StrategyRegistry:
    """策略注册器"""
    _strategies: Dict[str, "BaseSyncStrategy"] = {}

    @classmethod
    def register(cls, node_type: str, strategy: "BaseSyncStrategy"):
        """注册策略"""
        cls._strategies[node_type] = strategy

    @classmethod
    def get_strategy(cls, node_type: str) -> Optional["BaseSyncStrategy"]:
        """获取策略"""
        return cls._strategies.get(node_type)
    
    @classmethod
    def clear(cls):
        """清空所有注册的策略（用于测试）"""
        cls._strategies.clear()
