/**
 * SDK API Error Class
 *
 * Thrown when the API returns an error response with the new envelope format.
 * Provides typed access to error details including code, message, request ID, and field errors.
 */
import type { ApiError, ApiErrorCode, FieldError } from '../public-api/contracts';
/**
 * Error options for creating RiverbankApiError
 */
export interface RiverbankApiErrorOptions {
    code: ApiErrorCode;
    message: string;
    requestId: string;
    status: number;
    timestamp: string;
    fieldErrors?: FieldError[];
    /** Retry delay from Retry-After header, in milliseconds */
    retryAfterMs?: number;
    /** Original error that caused this error (for network errors) */
    cause?: Error;
}
/**
 * Error thrown by SDK when API returns an error response
 *
 * @example
 * ```ts
 * try {
 *   await client.getSite({ slug: 'my-site' });
 * } catch (error) {
 *   if (error instanceof RiverbankApiError) {
 *     console.log('Error code:', error.code);
 *     console.log('Request ID:', error.requestId);
 *
 *     if (error.isAuthError()) {
 *       // Handle authentication error
 *     }
 *
 *     if (error.isValidationError() && error.fieldErrors) {
 *       // Handle field-level validation errors
 *       error.fieldErrors.forEach(fe => {
 *         console.log(`${fe.field}: ${fe.message}`);
 *       });
 *     }
 *
 *     // Check if error can be retried
 *     if (error.isRetryable) {
 *       const delay = error.retryAfterMs ?? 1000;
 *       console.log(`Retrying after ${delay}ms...`);
 *     }
 *   }
 * }
 * ```
 */
export declare class RiverbankApiError extends Error {
    /** Namespaced error code (e.g., 'auth:unauthenticated', 'validation:invalid_input') */
    readonly code: ApiErrorCode;
    /** Unique request ID for debugging/support */
    readonly requestId: string;
    /** HTTP status code */
    readonly status: number;
    /** Field-level validation errors (only present for validation errors) */
    readonly fieldErrors?: FieldError[];
    /** ISO timestamp when the error occurred */
    readonly timestamp: string;
    /** Original error cause for error classification (ECONNREFUSED, etc.) */
    readonly cause?: Error;
    /**
     * Whether this error is safe to retry.
     * True for: 429 rate limit, 5xx server errors
     * False for: 4xx client errors (except 429)
     */
    readonly isRetryable: boolean;
    /**
     * Suggested retry delay from Retry-After header, in milliseconds.
     * Only present when the server provides a Retry-After header.
     */
    readonly retryAfterMs?: number;
    constructor(apiError: ApiError['error'] | RiverbankApiErrorOptions);
    /**
     * Compute whether this error is retryable based on HTTP status code.
     * - 0 (network errors - no HTTP response): retryable
     * - 429 (rate limit): retryable
     * - 5xx (server errors): retryable
     * - 4xx (client errors, except 429): NOT retryable
     */
    private computeRetryable;
    /**
     * Check if this is a network error (no HTTP response received)
     *
     * Matches: network:connection_error, network:timeout, network:dns_error
     */
    isNetworkError(): boolean;
    /**
     * Check if this error matches a specific error code
     *
     * @example
     * ```ts
     * if (error.is('auth:unauthenticated')) {
     *   // Redirect to login
     * }
     * ```
     */
    is(code: ApiErrorCode): boolean;
    /**
     * Check if this is an authentication or authorization error
     *
     * Matches: auth:unauthenticated, auth:token_expired, auth:token_invalid,
     * auth:forbidden, auth:mfa_required, auth:insufficient_permissions
     */
    isAuthError(): boolean;
    /**
     * Check if this is a validation error
     *
     * Matches: validation:invalid_input, validation:missing_field, validation:invalid_format
     */
    isValidationError(): boolean;
    /**
     * Check if this is a resource error (not found, conflict, etc.)
     *
     * Matches: resource:not_found, resource:already_exists, resource:conflict, resource:gone
     */
    isResourceError(): boolean;
    /**
     * Check if this is a rate limiting error
     */
    isRateLimitError(): boolean;
    /**
     * Check if this is a billing/payment error
     */
    isBillingError(): boolean;
    /**
     * Check if this is a server error
     */
    isServerError(): boolean;
    /**
     * Returns a human-readable string representation of the error.
     * Includes all key details for debugging.
     *
     * @example
     * "RiverbankApiError: Content keys cannot access preview content | Code: auth:forbidden | Status: 401 | RequestId: req-abc123"
     */
    toString(): string;
    /**
     * Returns a detailed multi-line string for debugging.
     * Used by the Node.js inspect symbol for console output.
     */
    toDetailedString(): string;
}
