"""매매 기법 레지스트리."""

from __future__ import annotations

from deepcoin.techniques.base import BaseTechnique
from deepcoin.techniques.bb_reversal import BbReversalTechnique
from deepcoin.techniques.donchian import DonchianTechnique
from deepcoin.techniques.local_extrema import LocalExtremaTechnique
from deepcoin.techniques.ma_cross import MaCrossTechnique
from deepcoin.techniques.macd_cross import MacdCrossTechnique
from deepcoin.techniques.minor_swing import MinorSwingTechnique
from deepcoin.techniques.rsi_swing import RsiSwingTechnique
from deepcoin.techniques.zigzag_causal import ZigzagCausalTechnique

_ALL_TECHNIQUES: list[BaseTechnique] = [
    ZigzagCausalTechnique(),
    MinorSwingTechnique(),
    LocalExtremaTechnique(),
    BbReversalTechnique(),
    MaCrossTechnique(),
    RsiSwingTechnique(),
    MacdCrossTechnique(),
    DonchianTechnique(),
]


def get_all_techniques() -> list[BaseTechnique]:
    """등록된 모든 매매 기법을 반환한다."""
    return list(_ALL_TECHNIQUES)


def get_technique(technique_id: str) -> BaseTechnique | None:
    """ID로 기법을 조회한다."""
    for technique in _ALL_TECHNIQUES:
        if technique.technique_id == technique_id:
            return technique
    return None


def list_technique_ids() -> list[str]:
    """기법 ID 목록을 반환한다."""
    return [t.technique_id for t in _ALL_TECHNIQUES]
