"""SparkNet exceptions."""


class SparkNetError(Exception):
    """Base exception for SparkNet."""
    pass


class ConstitutionalViolation(SparkNetError):
    """Content violates constitutional principles."""

    def __init__(self, message: str, tier: str = "FORBIDDEN", reason: str = ""):
        self.tier = tier
        self.reason = reason
        super().__init__(f"Constitutional violation ({tier}): {message}")


class NetworkError(SparkNetError):
    """Network communication error."""

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


class RateLimitError(SparkNetError):
    """Rate limit exceeded."""

    def __init__(self, message: str = "Rate limit exceeded", retry_after: int = None):
        self.retry_after = retry_after
        super().__init__(message)


class AuthenticationError(SparkNetError):
    """Authentication failed."""
    pass


class ValidationError(SparkNetError):
    """Input validation failed."""
    pass
