import { z } from 'zod';
import type { ApiError, QueryParams } from './core';
export declare const HttpMethodSchema: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
export type HttpMethod = z.infer<typeof HttpMethodSchema>;
export declare const HttpStatusSchema: z.ZodEnum<["200", "201", "202", "204", "400", "401", "403", "404", "409", "422", "429", "500", "502", "503", "504"]>;
export type HttpStatus = z.infer<typeof HttpStatusSchema>;
export interface HttpHeaders {
    [key: string]: string;
}
export interface HttpRequestConfig {
    method: HttpMethod;
    url: string;
    headers?: HttpHeaders;
    params?: QueryParams;
    data?: unknown;
    timeout?: number;
    withCredentials?: boolean;
    responseType?: 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
    validateStatus?: (status: number) => boolean;
    onUploadProgress?: (progressEvent: ProgressEvent) => void;
    onDownloadProgress?: (progressEvent: ProgressEvent) => void;
    signal?: AbortSignal;
}
export interface HttpResponse<T = unknown> {
    data: T;
    status: number;
    statusText: string;
    headers: HttpHeaders;
    config: HttpRequestConfig;
    request?: XMLHttpRequest;
}
export interface HttpError extends ApiError {
    code: string;
    status: number;
    message: string;
    details?: unknown;
    config: HttpRequestConfig;
    request?: XMLHttpRequest;
    response?: HttpResponse;
}
export interface HttpInterceptor {
    request?: (config: HttpRequestConfig) => HttpRequestConfig | Promise<HttpRequestConfig>;
    response?: (response: HttpResponse) => HttpResponse | Promise<HttpResponse>;
    error?: (error: HttpError) => HttpError | Promise<HttpError>;
}
export interface HttpInstance {
    request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
    get<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
    post<T = unknown>(url: string, data?: unknown, config?: Omit<HttpRequestConfig, 'method' | 'url' | 'data'>): Promise<HttpResponse<T>>;
    put<T = unknown>(url: string, data?: unknown, config?: Omit<HttpRequestConfig, 'method' | 'url' | 'data'>): Promise<HttpResponse<T>>;
    patch<T = unknown>(url: string, data?: unknown, config?: Omit<HttpRequestConfig, 'method' | 'url' | 'data'>): Promise<HttpResponse<T>>;
    delete<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
    head<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
    options<T = unknown>(url: string, config?: Omit<HttpRequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
}
export interface HttpConfig {
    baseURL?: string;
    timeout?: number;
    headers?: HttpHeaders;
    withCredentials?: boolean;
    validateStatus?: (status: number) => boolean;
    transformRequest?: Array<(data: unknown, headers?: HttpHeaders) => unknown>;
    transformResponse?: Array<(data: unknown, headers?: HttpHeaders) => unknown>;
    paramsSerializer?: (params: QueryParams) => string;
    interceptors?: {
        request?: HttpInterceptor[];
        response?: HttpInterceptor[];
    };
}
export interface HttpFactory {
    create(config?: HttpConfig): HttpInstance;
    isCancel(error: unknown): boolean;
    CancelToken: {
        new (executor: (cancel: (message?: string) => void) => void): {
            token: AbortSignal;
            reason?: string;
        };
        source(): {
            token: AbortSignal;
            cancel: (message?: string) => void;
        };
    };
}
export interface HttpCache {
    get<T>(key: string): Promise<T | null>;
    set<T>(key: string, value: T, ttl?: number): Promise<void>;
    delete(key: string): Promise<void>;
    clear(): Promise<void>;
}
export interface HttpRateLimiter {
    isRateLimited(key: string): Promise<boolean>;
    increment(key: string): Promise<void>;
    reset(key: string): Promise<void>;
}
export interface HttpRetryConfig {
    retries: number;
    retryDelay: number | ((retryCount: number) => number);
    retryCondition: (error: HttpError) => boolean;
}
export interface HttpMetrics {
    requestCount: number;
    successCount: number;
    errorCount: number;
    totalLatency: number;
    averageLatency: number;
    lastRequestTime: number;
    reset(): void;
}
export interface HttpClient extends HttpInstance {
    config: HttpConfig;
    interceptors: {
        request: HttpInterceptor[];
        response: HttpInterceptor[];
    };
    cache: HttpCache;
    rateLimiter: HttpRateLimiter;
    metrics: HttpMetrics;
    setConfig(config: Partial<HttpConfig>): void;
    addInterceptor(interceptor: HttpInterceptor): void;
    removeInterceptor(interceptor: HttpInterceptor): void;
    setAuthToken(token: string): void;
    clearAuthToken(): void;
    setBaseURL(url: string): void;
    setTimeout(timeout: number): void;
    setRetryConfig(config: HttpRetryConfig): void;
    setCache(cache: HttpCache): void;
    setRateLimiter(rateLimiter: HttpRateLimiter): void;
    reset(): void;
}
//# sourceMappingURL=http.d.ts.map