"""
Abstract interfaces for Storm Console dependency injection.
Provides abstractions for all external dependencies.
"""

from abc import ABC, abstractmethod
from typing import Any


class ConsoleFactory(ABC):
    """Factory for creating Rich console instances."""

    @abstractmethod
    def create_console(
        self, theme: Any, force_terminal: bool, legacy_windows: bool, safe_box: bool, stderr: bool
    ) -> Any:
        """Create a console instance."""
        pass


class SyntaxFactory(ABC):
    """Factory for creating Rich syntax highlighting."""

    @abstractmethod
    def create_syntax(self, code: str, language: str, theme: str) -> Any:
        """Create a syntax highlighter instance."""
        pass


class ProgressFactory(ABC):
    """Factory for creating Rich progress bars."""

    @abstractmethod
    def create_progress(
        self, *columns: Any, console: Any = None, refresh_per_second: float = 10
    ) -> Any:
        """Create a progress bar instance."""
        pass

    @abstractmethod
    def create_spinner_column(self) -> Any:
        """Create a spinner column."""
        pass

    @abstractmethod
    def create_text_column(self, text_format: str) -> Any:
        """Create a text column."""
        pass

    @abstractmethod
    def create_bar_column(self) -> Any:
        """Create a bar column."""
        pass


class RichComponentFactory(ABC):
    """Factory for creating various Rich components."""

    @abstractmethod
    def create_table(
        self,
        title: str | None = None,
        show_header: bool = True,
        header_style: str | None = None,
    ) -> Any:
        """Create a table instance."""
        pass

    @abstractmethod
    def create_panel(
        self,
        content: Any,
        title: str | None = None,
        style: str | None = None,
        padding: tuple[int, int] = (0, 1),
    ) -> Any:
        """Create a panel instance."""
        pass

    @abstractmethod
    def create_text(self, text: str, style: str | None = None) -> Any:
        """Create a text instance."""
        pass

    @abstractmethod
    def create_columns(self, renderables: list[Any]) -> Any:
        """Create columns layout."""
        pass

    @abstractmethod
    def create_layout(self) -> Any:
        """Create a layout instance."""
        pass

    @abstractmethod
    def create_live(self, renderable: Any, console: Any, refresh_per_second: float = 4) -> Any:
        """Create a live display instance."""
        pass


class ThemeProvider(ABC):
    """Provider for theme configurations."""

    @abstractmethod
    def get_theme(self, theme_name: str) -> Any:
        """Get theme configuration by name."""
        pass


class ConfigProvider(ABC):
    """Provider for configuration."""

    @abstractmethod
    def get_config(self) -> Any:
        """Get current configuration."""
        pass


class SafetyProvider(ABC):
    """Provider for console safety mechanisms."""

    @abstractmethod
    def get_safety_wrapper(self) -> Any:
        """Get the safety wrapper instance."""
        pass
