"""ACIS SDK exceptions — typed error hierarchy."""


class ACISError(Exception):
    """Base exception for all ACIS SDK errors."""

    def __init__(self, message: str, code: str = "ACIS_ERROR"):
        self.message = message
        self.code = code
        super().__init__(message)


class ACISRateLimitError(ACISError):
    """Raised when a rate limit is exceeded (HTTP 429 equivalent)."""

    def __init__(self, message: str, retry_after: float = 0):
        self.retry_after = retry_after
        super().__init__(message, code="RATE_LIMIT_EXCEEDED")


class ACISSessionNotFoundError(ACISError):
    """Raised when a session does not exist."""

    def __init__(self, session_id: str):
        self.session_id = session_id
        super().__init__(f"Session not found: {session_id}", code="SESSION_NOT_FOUND")


class ACISCircuitOpenError(ACISError):
    """Raised when the write circuit breaker is open."""

    def __init__(self):
        super().__init__("Service temporarily unavailable (circuit open)", code="CIRCUIT_OPEN")


class ACISValidationError(ACISError):
    """Raised on invalid input parameters."""

    def __init__(self, message: str):
        super().__init__(message, code="VALIDATION_ERROR")
