/**
 * @module http-compat
 * HTTP client compatibility adapters for xBind auto-upgrade
 *
 * Provides drop-in replacements for popular HTTP clients (fetch, axios, got)
 * that transparently upgrade to xBind when both parties support it.
 */
import { xfetch } from './xfetch.js';
/**
 * Axios-compatible request config
 */
export interface AxiosRequestConfig {
    url?: string;
    method?: string;
    baseURL?: string;
    headers?: Record<string, string>;
    params?: Record<string, unknown>;
    data?: unknown;
    timeout?: number;
    responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
    validateStatus?: (status: number) => boolean;
    forceXBind?: boolean;
    disableXBind?: boolean;
}
/**
 * Axios-compatible response
 */
export interface AxiosResponse<T = unknown> {
    data: T;
    status: number;
    statusText: string;
    headers: Record<string, string>;
    config: AxiosRequestConfig;
    request?: unknown;
    xbind?: {
        used: boolean;
        protocol: 'xbind' | 'http' | 'https';
        latency?: number;
        peerDID?: string;
    };
}
/**
 * Got-compatible options
 */
export interface GotOptions {
    url?: string;
    method?: string;
    headers?: Record<string, string>;
    searchParams?: Record<string, string | number | boolean>;
    json?: unknown;
    body?: string | Buffer;
    timeout?: number | {
        request?: number;
    };
    responseType?: 'json' | 'text' | 'buffer';
    forceXBind?: boolean;
    disableXBind?: boolean;
}
/**
 * Got-compatible response
 */
export interface GotResponse<T = unknown> {
    body: T;
    statusCode: number;
    headers: Record<string, string>;
    url: string;
    requestUrl: string;
    xbind?: {
        used: boolean;
        protocol: 'xbind' | 'http' | 'https';
        latency?: number;
        peerDID?: string;
    };
}
/**
 * Create axios-compatible HTTP client with xBind auto-upgrade
 *
 * Drop-in replacement for axios that transparently upgrades to xBind.
 *
 * @returns Axios-compatible client
 *
 * @example
 * ```typescript
 * import { createAxiosCompat } from '@private.me/xbind/http-compat';
 *
 * const axios = createAxiosCompat();
 *
 * // Auto-upgrades to xBind if supported
 * const response = await axios.get('https://api.example.com/data');
 * console.log('Used xBind?', response.xbind?.used);
 * console.log('Data:', response.data);
 * ```
 */
export declare function createAxiosCompat(): {
    request: <T = unknown>(config: AxiosRequestConfig | string) => Promise<AxiosResponse<T>>;
    get: <T = unknown>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
    post: <T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
    put: <T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
    patch: <T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
    delete: <T = unknown>(url: string, config?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
};
/**
 * Create got-compatible HTTP client with xBind auto-upgrade
 *
 * Drop-in replacement for got that transparently upgrades to xBind.
 *
 * @returns Got-compatible client
 *
 * @example
 * ```typescript
 * import { createGotCompat } from '@private.me/xbind/http-compat';
 *
 * const got = createGotCompat();
 *
 * // Auto-upgrades to xBind if supported
 * const response = await got('https://api.example.com/data', {
 *   responseType: 'json',
 * });
 * console.log('Used xBind?', response.xbind?.used);
 * console.log('Body:', response.body);
 * ```
 */
export declare function createGotCompat(): {
    <T = unknown>(url: string | GotOptions, options?: GotOptions): Promise<GotResponse<T>>;
    get<T = unknown>(url: string, options?: GotOptions): Promise<GotResponse<T>>;
    post<T = unknown>(url: string, options?: GotOptions): Promise<GotResponse<T>>;
    put<T = unknown>(url: string, options?: GotOptions): Promise<GotResponse<T>>;
    patch<T = unknown>(url: string, options?: GotOptions): Promise<GotResponse<T>>;
    delete<T = unknown>(url: string, options?: GotOptions): Promise<GotResponse<T>>;
};
/**
 * Wrap existing fetch implementation with xBind auto-upgrade
 *
 * Use this to upgrade an existing fetch instance (like node-fetch, cross-fetch, etc.)
 *
 * @param fetchImpl - Fetch implementation to wrap
 * @returns Wrapped fetch with xBind support
 *
 * @example
 * ```typescript
 * import { wrapFetch } from '@private.me/xbind/http-compat';
 * import nodeFetch from 'node-fetch';
 *
 * const fetch = wrapFetch(nodeFetch);
 *
 * // Uses xBind if supported, falls back to node-fetch
 * const response = await fetch('https://api.example.com/data');
 * ```
 */
export declare function wrapFetch(_fetchImpl: typeof fetch): typeof xfetch;
