import abc

import pandas as pd

from signalab.data.market_data import MarketData


class Indicator(abc.ABC):
    """Base interface for all indicators.

    Parameters
    ----------
    name : str
        Human-readable indicator name.
    label : str | None, default=None
        Identifier prefix used by the engine when namespacing output columns.
    """

    def __init__(self, name: str, label: str | None = None):
        """Initialize indicator metadata.

        Parameters
        ----------
        name : str
            Human-readable indicator name.
        label : str | None, default=None
            Optional stable label for output namespacing.
        """
        self.name = name
        self.label = label

    @abc.abstractmethod
    def compute(self, data: MarketData) -> pd.DataFrame:
        """Compute indicator values for a market dataset.

        Parameters
        ----------
        data : MarketData
            Source market data object.

        Returns
        -------
        pd.DataFrame
            Indicator output indexed by timestamp. For signal-based indicators,
            one column is usually named ``signal``.
        """
        raise NotImplementedError
