"""Abstract base class for data providers."""
from __future__ import annotations

from abc import ABC, abstractmethod
from datetime import datetime
from typing import Optional


class AbstractDataProvider(ABC):
    """Base class that all data source providers must implement."""

    provider_id: str = ''  # e.g. 'coingecko', 'indodax'

    @abstractmethod
    def get_ohlcv(self, asset_id: str, timeframe: str,
                  start: datetime, end: datetime) -> list[dict]:
        """Fetch OHLCV data.

        Returns:
            List of dicts with keys: timestamp, open, high, low, close, volume
        """

    @abstractmethod
    def search_coins(self, query: str) -> list[dict]:
        """Search assets by name or symbol.

        Returns:
            List of dicts with keys: id, symbol, name
        """

    @abstractmethod
    def get_coin_profile(self, asset_id: str) -> Optional[dict]:
        """Fetch comprehensive asset profile data."""

    @abstractmethod
    def get_current_price(self, asset_id: str) -> Optional[float]:
        """Get current price in IDR."""

    @abstractmethod
    def is_available(self, asset_id: str) -> bool:
        """Check if a asset is available on this provider."""
