"""Feature-calculator contract. A calculator is a STATEFUL streaming object fed snapshots/bars in
timestamp order (never indexing forward — the causal discipline the Rust framework enforces). Each
update returns a {feature_name: value} row for that point in time."""
from __future__ import annotations

from typing import Protocol, runtime_checkable

from fxhnt.domain.marketdata import Mbp10Snapshot


@runtime_checkable
class SnapshotFeatureCalculator(Protocol):
    name: str
    feature_names: tuple[str, ...]

    def update(self, snap: Mbp10Snapshot) -> dict[str, float]:
        """Consume one snapshot (in time order) and emit this point-in-time's features."""
        ...

    def reset(self) -> None: ...
