from typing import Any


class GatewayError(Exception):
    code = "gateway_error"
    http_status = 500

    def __init__(self, message: str = "", **context: Any) -> None:
        super().__init__(message)
        self.context = context


class CapabilityConflict(GatewayError):
    code = "capability_conflict"
    http_status = 409


class BudgetExceeded(GatewayError):
    code = "budget_exceeded"
    http_status = 402


class TokenBudgetExceeded(GatewayError):
    code = "token_budget_exceeded"
    http_status = 413


class NoCapacityWithinPolicy(GatewayError):
    code = "no_capacity_within_policy"
    http_status = 503


class RateLimitExceeded(GatewayError):
    code = "rate_limit"
    http_status = 429


class AuthenticationError(GatewayError):
    code = "authentication"
    http_status = 401


class StreamingNotSupported(GatewayError):
    code = "streaming_not_supported"
    http_status = 400
