"""Custom exceptions for Telegram Gateway client."""

from __future__ import annotations


class TelegramGatewayError(Exception):
    """Base exception for all gateway-related errors."""


class TelegramGatewayHTTPError(TelegramGatewayError):
    """Raised when transport-level HTTP/network errors occur."""


class TelegramGatewayAPIError(TelegramGatewayError):
    """Raised when Telegram Gateway returns ok=false."""

    def __init__(self, error: str, status_code: int | None = None) -> None:
        self.error = error
        self.status_code = status_code
        message = f"Telegram Gateway API error: {error}"
        if status_code is not None:
            message = f"{message} (HTTP {status_code})"
        super().__init__(message)


class TelegramGatewayValidationError(TelegramGatewayError):
    """Raised when client-side validation fails before request is sent."""
