"""
Provider-specific exception classes.

All provider errors inherit from ProviderError, which formats messages
with the provider name prefix for easy identification in logs.
"""

from __future__ import annotations


class ProviderError(Exception):
    """Base exception for all provider errors."""

    def __init__(self, provider: str, message: str):
        self.provider = provider
        super().__init__(f"[{provider}] {message}")


class ProviderUnavailableError(ProviderError):
    """Provider cannot be used (missing credentials, not installed, etc.)."""

    def __init__(self, provider: str, reason: str):
        self.reason = reason
        super().__init__(provider, f"Provider unavailable: {reason}")


class ProviderGenerationError(ProviderError):
    """Generation failed during execution."""

    def __init__(self, provider: str, reason: str, original: Exception | None = None):
        self.reason = reason
        self.original = original
        super().__init__(provider, f"Generation failed: {reason}")


class ProviderNotConfiguredError(ProviderError):
    """Provider is selected but not properly configured."""

    def __init__(self, provider: str, missing: list[str]):
        self.missing = missing
        super().__init__(provider, f"Missing configuration: {', '.join(missing)}")
