# app/src/trading/decision/service.py

from __future__ import annotations

from src.trading.market_intelligence.common.models import CoordinatorResult
from src.trading.decision.models import TradingDecision
from src.trading.decision.protocol import TradingProtocol
from src.trading.decision.rules import TradingRules
from src.trading.decision.validation import (
    TradingValidation,
)


class TradingService(TradingProtocol):
    """Единая публичная точка входа Trading Layer."""

    def __init__(self) -> None:
        """Создать Trading Service."""
        self._validation = TradingValidation()
        self._rules = TradingRules()

    async def decide(
        self,
        coordinator_result: CoordinatorResult,
    ) -> TradingDecision:
        """Сформировать торговое решение."""
        self._validation.validate(coordinator_result)

        return self._rules.decide(coordinator_result)