# services/external/app/ingestion/base_adapter.py
"""
Base adapter interface for city-specific data sources
"""

from abc import ABC, abstractmethod
from typing import List, Dict, Any
from datetime import datetime


class CityDataAdapter(ABC):
    """Abstract base class for city-specific data adapters"""

    def __init__(self, city_id: str, config: Dict[str, Any]):
        self.city_id = city_id
        self.config = config

    @abstractmethod
    async def fetch_historical_weather(
        self,
        start_date: datetime,
        end_date: datetime
    ) -> List[Dict[str, Any]]:
        """Fetch historical weather data for date range"""
        pass

    @abstractmethod
    async def fetch_historical_traffic(
        self,
        start_date: datetime,
        end_date: datetime
    ) -> List[Dict[str, Any]]:
        """Fetch historical traffic data for date range"""
        pass

    @abstractmethod
    async def validate_connection(self) -> bool:
        """Validate connection to data source"""
        pass

    def get_city_id(self) -> str:
        """Get city identifier"""
        return self.city_id
