"""
Abstract interfaces for base logger dependencies to improve testability.
"""

from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any


class LoggerFactory(ABC):
    """Abstract interface for creating logger instances."""

    @abstractmethod
    def get_logger(self, name: str) -> Any:
        """Get a logger instance by name."""
        pass

    @abstractmethod
    def set_level(self, logger: Any, level: int) -> None:
        """Set the logging level for a logger."""
        pass

    @abstractmethod
    def get_level(self, logger: Any) -> int:
        """Get the current logging level of a logger."""
        pass

    @abstractmethod
    def is_enabled_for(self, logger: Any, level: int) -> bool:
        """Check if logging is enabled for a specific level."""
        pass

    @abstractmethod
    def log(self, logger: Any, level: int, message: str, **kwargs: Any) -> None:
        """Log a message at a specific level."""
        pass


class DependencyChecker(ABC):
    """Abstract interface for checking optional dependencies."""

    @abstractmethod
    def is_available(self, module_name: str) -> bool:
        """Check if a module is available for import."""
        pass


class FormatterFactory(ABC):
    """Abstract interface for creating log formatters."""

    @abstractmethod
    def create_colored_formatter(self) -> dict[str, Any]:
        """Create a colored formatter configuration."""
        pass

    @abstractmethod
    def create_json_formatter(self) -> dict[str, Any]:
        """Create a JSON formatter configuration."""
        pass

    @abstractmethod
    def create_standard_formatter(self) -> dict[str, Any]:
        """Create a standard formatter configuration."""
        pass


class ConfigurationBuilder(ABC):
    """Abstract interface for building logging configurations."""

    @abstractmethod
    def build_base_config(self, config: Any) -> dict[str, Any]:
        """Build base logging configuration."""
        pass

    @abstractmethod
    def add_debug_handler(self, logging_config: dict[str, Any], config: Any) -> None:
        """Add debug handler to logging configuration."""
        pass


class DirectoryManager(ABC):
    """Abstract interface for managing directories."""

    @abstractmethod
    def create_directories(self, config: Any) -> None:
        """Create necessary directories based on configuration."""
        pass

    @abstractmethod
    def ensure_directory_exists(self, path: Path) -> None:
        """Ensure a specific directory exists."""
        pass
