"""SignalGenerator base: interpret window and emit Signal or None."""

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from pyalbedo.core.types import Signal
    from pyalbedo.core.window import MarketDataWindow


class SignalGenerator(ABC):
    """
    Interprets market data (and optionally indicators) and emits signals.

    Returns None when no signal (most of the time).
    """

    @property
    @abstractmethod
    def name(self) -> str:
        """Generator name for signal attribution."""
        pass

    @property
    @abstractmethod
    def required_lookback(self) -> int:
        """Minimum bars needed in the window."""
        pass

    @abstractmethod
    def generate(self, window: MarketDataWindow) -> Signal | None:
        """
        Analyze window; return signal if conditions met, else None.
        """
        pass
