"""KairosRoute SDK exceptions."""


class KairosRouteError(Exception):
    """Base exception for KairosRoute SDK."""

    def __init__(self, message: str, code: str | None = None, status_code: int | None = None):
        super().__init__(message)
        self.code = code
        self.status_code = status_code


class AuthenticationError(KairosRouteError):
    """Raised when API key is invalid or missing."""
    pass


class RateLimitError(KairosRouteError):
    """Raised when rate limit is exceeded."""

    def __init__(self, message: str, retry_after: float | None = None):
        super().__init__(message, code="RATE_LIMIT_EXCEEDED", status_code=429)
        self.retry_after = retry_after


class BudgetExceededError(KairosRouteError):
    """Raised when daily budget is exceeded."""
    pass


class ProviderError(KairosRouteError):
    """Raised when upstream provider fails."""
    pass
