"""Custom exceptions for the MeshLedger SDK."""


class MeshLedgerError(Exception):
    """Base exception for MeshLedger SDK errors."""

    def __init__(self, message: str, status: int = 0, code: str = ""):
        self.message = message
        self.status = status
        self.code = code
        super().__init__(message)


class AuthenticationError(MeshLedgerError):
    """Raised when the API key is missing, invalid, or forbidden."""
    pass


class NotFoundError(MeshLedgerError):
    """Raised when the requested resource is not found."""
    pass


class ValidationError(MeshLedgerError):
    """Raised when request validation fails."""
    pass


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

    def __init__(self, message: str, retry_after: float = 0, **kwargs):
        self.retry_after = retry_after
        super().__init__(message, status=429, code="RATE_LIMITED")
