"""Persistence contracts. Stores by purpose (per the chosen Postgres + DuckDB split):
  * OperationalRepository — relational (Postgres/SQLite): research runs, verdicts, survivor library.
  * AnalyticalStore       — columnar (DuckDB): market price series + backtest return timeseries.
"""
from __future__ import annotations

from typing import Protocol

import numpy as np

from fxhnt.domain.models import Market, PriceSeries, ResearchRun


class OperationalRepository(Protocol):
    def save_run(self, run: ResearchRun) -> None: ...

    def get_run(self, run_id: str) -> ResearchRun | None: ...

    def list_runs(self, *, passed_only: bool = False) -> list[ResearchRun]: ...


class AnalyticalStore(Protocol):
    def save_prices(self, prices: PriceSeries) -> None: ...

    def load_prices(self, market: Market) -> PriceSeries | None: ...

    def save_returns(self, run_id: str, dates: tuple[str, ...], returns: np.ndarray) -> None: ...
