"""Exception classes for AI service errors."""

from __future__ import annotations


class AIServiceError(Exception):
    """
    Raised when the AI service returns an error HTTP response.

    .. attribute:: status_code

        The HTTP status code.

    .. attribute:: response_text

        The response body.
    """

    def __init__(self, status_code: int, response_text: str) -> None:
        """Initialize with the HTTP status code and response body."""
        self.status_code = status_code
        self.response_text = response_text
        super().__init__(f"AI service returned {status_code}")


class AIServiceConnectionError(Exception):
    """
    Raised when the AI service is unreachable.
    """


class InvalidAPIKeyError(Exception):
    """
    Raised when no API key is found or it has an invalid format.
    """
