# app/src/trading/market_intelligence/runtime/protocol.py

from __future__ import annotations

from typing import Protocol

from src.trading.market_intelligence.common.models import (
    EngineContext,
    RuntimeResult,
)
from src.trading.market_intelligence.common.types import EngineName
from src.trading.market_intelligence.engine.protocol import EngineProtocol


class RuntimeProtocol(Protocol):
    """Контракт Runtime Layer."""

    def register_engine(
        self,
        engine_type: type[EngineProtocol],
    ) -> None:
        """Зарегистрировать класс Engine в Runtime."""
        ...

    def unregister_engine(
        self,
        engine_name: EngineName,
    ) -> None:
        """Удалить Engine из Runtime по имени."""
        ...

    def get_engine(
        self,
        engine_name: EngineName,
    ) -> type[EngineProtocol] | None:
        """Вернуть зарегистрированный класс Engine по имени."""
        ...

    async def analyze(
        self,
        context: EngineContext,
    ) -> RuntimeResult:
        """Выполнить анализ через зарегистрированные Engine."""
        ...