"""
Custom exceptions for the Wave Business API SDK.
"""


class WaveAPIError(Exception):
    """Base exception for all Wave API errors."""

    def __init__(self, message: str, status_code: int = None, error_code: str = None, details=None):
        super().__init__(message)
        self.message = message
        self.status_code = status_code
        self.error_code = error_code
        self.details = details

    def __repr__(self):
        return (
            f"{self.__class__.__name__}("
            f"message={self.message!r}, "
            f"status_code={self.status_code}, "
            f"error_code={self.error_code!r})"
        )


class WaveAuthError(WaveAPIError):
    """Raised for authentication/authorization failures (401, 403)."""
    pass


class WaveNotFoundError(WaveAPIError):
    """Raised when a resource is not found (404)."""
    pass


class WaveValidationError(WaveAPIError):
    """Raised for request validation errors (400, 422)."""
    pass


class WaveRateLimitError(WaveAPIError):
    """Raised when the rate limit is exceeded (429)."""
    pass


class WaveServerError(WaveAPIError):
    """Raised for server-side errors (500, 503)."""
    pass


class WaveWebhookError(WaveAPIError):
    """Raised for webhook signature validation failures."""
    pass


class WaveIdempotencyError(WaveAPIError):
    """Raised for idempotency key conflicts (409)."""
    pass
