from abc import ABC, abstractmethod
from typing import List, Dict, Any, AsyncIterator
from dataclasses import dataclass

@dataclass
class FileInfo:
    path: str
    size: int
    modified_time: float
    is_directory: bool

class SourceAdapter(ABC):
    def __init__(self, config: Dict[str, Any]):
        self.config = config
    
    @abstractmethod
    async def connect(self) -> None:
        """Establish connection to source."""
        pass
    
    @abstractmethod
    async def disconnect(self) -> None:
        """Close connection to source."""
        pass
    
    @abstractmethod
    async def list_files(self, path: str = "") -> List[FileInfo]:
        """List files at given path."""
        pass
    
    @abstractmethod
    async def read_file(self, path: str) -> AsyncIterator[bytes]:
        """Read file in chunks."""
        pass
    
    @abstractmethod
    async def get_database_dump(self, config: Dict[str, Any]) -> AsyncIterator[bytes]:
        """Get database dump. Only implemented for database adapters."""
        pass
