import logging
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Generator, IO
from contextlib import contextmanager

logger = logging.getLogger(__name__)

class FileSystemPort(ABC):
    @abstractmethod
    async def gatherFileList(self, path: Path, dataTypes: list[str] =None, recursive: bool = False) -> None | list[str]:
        logger.info("gather FileList needs to be implemented")
        raise NotImplementedError

    @abstractmethod
    @contextmanager
    def getFile(self, path: Path, write:bool = False) -> Generator[IO[Any], Any, None]:
        raise NotImplementedError

    @abstractmethod
    async def getFileSize(self, path: Path):
        raise NotImplementedError

    @abstractmethod
    async def createZip(self, path: Path):
        raise NotImplementedError

    @abstractmethod
    def deleteFile(self, path: Path):
        raise NotImplementedError

    @abstractmethod
    def getChecksum(self, path: Path, checksumType: str) -> bool:
        raise NotImplementedError
