"""Abstract base store defining the storage interface."""

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, List, Optional

if TYPE_CHECKING:
    from sd_api.models.quote import Quote
    from sd_api.models.kline import KlineBar


class BaseStore(ABC):
    """Abstract interface for persisting market data.

    All store implementations must implement these methods.
    """

    @abstractmethod
    def save_quote(self, quote: "Quote") -> None:
        """Persist a single quote."""
        raise NotImplementedError

    @abstractmethod
    def save_quotes(self, quotes: List["Quote"]) -> None:
        """Persist a batch of quotes."""
        raise NotImplementedError

    @abstractmethod
    def save_kline(self, bars: List["KlineBar"], symbol: str = "", tf: str = "") -> None:
        """Persist a list of K-line bars."""
        raise NotImplementedError

    @abstractmethod
    def load_quotes(
        self,
        symbol: str,
        *,
        limit: int = 1000,
    ) -> List["Quote"]:
        """Load historical quotes for a symbol."""
        raise NotImplementedError

    @abstractmethod
    def load_kline(
        self,
        symbol: str,
        *,
        tf: str = "5min",
        limit: int = 500,
    ) -> List["KlineBar"]:
        """Load historical K-line bars for a symbol."""
        raise NotImplementedError
