"""
Legacy compatibility system exceptions.

Provides specialized exception classes for legacy system operations.
"""

class LegacyError(Exception):
    """Base exception for legacy compatibility system."""
    pass


class LegacyVersionNotFoundError(LegacyError):
    """Raised when a requested legacy version is not available."""

    def __init__(self, command: str, version: str, available_versions: list = None):
        self.command = command
        self.version = version
        self.available_versions = available_versions or []

        msg = f"Legacy version '{version}' not found for command '{command}'"
        if self.available_versions:
            msg += f". Available versions: {', '.join(self.available_versions)}"

        super().__init__(msg)


class DeprecationError(LegacyError):
    """Raised when deprecated functionality is accessed inappropriately."""

    def __init__(self, feature: str, deprecated_in: str, removal_date: str = None):
        self.feature = feature
        self.deprecated_in = deprecated_in
        self.removal_date = removal_date

        msg = f"Feature '{feature}' was deprecated in version {deprecated_in}"
        if removal_date:
            msg += f" and will be removed in {removal_date}"

        super().__init__(msg)


class LegacyConfigurationError(LegacyError):
    """Raised when legacy system configuration is invalid."""
    pass


class GitStateError(LegacyError):
    """Raised when git state operations fail."""
    pass


class CompatibilityError(LegacyError):
    """Raised when compatibility layer operations fail."""
    pass