import type { ContextHaving, ContextUsing } from '../../../framework-types/execution-context/Types';
import type { BaseContext } from '../../../framework-types/Types';
import type { PartialRequired } from '../../Types';
import type { AdaptationExportNames } from '../adaptation/Types';
import type { MetricsAtom } from '../core/metrics/MetricsAtom';
import type { StateEffect } from '../core/state/state-effect/StateEffectFactory';
import type { CoreEffects, CoreExportNames } from '../core/Types';
import type { CoreUtils } from '../core/utils/Types';
import type { FetchTask } from './FetchTask';
import type { HttpRequestMethod } from './HttpRequestMethod';
import type { HttpRequestType } from './HttpRequestType';
import type { HttpResponseType } from './HttpResponseType';
import type { createNetworkAtom, NetworkAtom } from './NetworkAtom';
import type { NetworkMessageType } from './NetworkMessageTypes';
import type { NetworkTask } from './NetworkTask';
export type { HttpRequestMethod } from './HttpRequestMethod';
export type { HttpRequestType } from './HttpRequestType';
export type { HttpResponseType } from './HttpResponseType';
export interface HttpHeaders {
        [fieldName: string]: string;
}
export type HttpRequestBody = ArrayBuffer | ArrayBufferView | Blob | FormData | string | Document | URLSearchParams;
export interface HttpResponseBodyTypeMap {
    [HttpResponseType.ARRAYBUFFER]: ArrayBuffer;
    [HttpResponseType.BLOB]: Blob;
    [HttpResponseType.DOCUMENT]: Document;
    [HttpResponseType.JSON]: Record<string, unknown>;
    [HttpResponseType.TEXT]: string;
}
export interface HttpTimingInformation {
        sendTimestamp: number;
        openedTimestamp: number;
        headersReceivedTimestamp: number;
        progressTimestamp: number;
        doneTimestamp: number;
}
export interface RequestConfig<T extends HttpResponseType> {
        method: HttpRequestMethod;
        url: string;
        headers: HttpHeaders;
        body: HttpRequestBody | undefined;
        responseType: T;
        credentials: 'omit' | 'same-origin' | 'include';
    numRetries: number;
    retryDelay: number;
    requestTimeout: number;
    disableRetriesForResponseStatus: number[];
}
export interface HttpResponse<T extends HttpResponseType> {
        config: RequestConfig<T>;
        url: string;
        headers: HttpHeaders;
        status: number;
        statusText: string;
        body: HttpResponseBodyTypeMap[T] | undefined;
        length: number;
    timingInformation: HttpTimingInformation;
}
export type BaseRequestConfig<T extends HttpResponseType> = PartialRequired<RequestConfig<T>, 'url' | 'responseType'>;
export type RequestContext<T extends HttpResponseType> = {
    config: RequestConfig<T>;
    networkAtom: NetworkAtom | undefined;
};
export type NetworkDependencies = {
    [CoreExportNames.CoreEffects]: CoreEffects;
    [CoreExportNames.Utils]: CoreUtils;
    [AdaptationExportNames.Metrics]: MetricsAtom;
};
export declare enum NetworkExportNames {
    NetworkAtom = "network-atom",
    NetworkTask = "network-task",
    FetchTask = "fetch-task",
    HttpRequestType = "http-request-type",
    HttpResponseType = "http-response-type",
    HttpRequestMethod = "http-request-method",
    NetworkMessageType = "network-message-type"
}
export type NetworkExports = {
    [NetworkExportNames.NetworkAtom]: typeof createNetworkAtom;
    [NetworkExportNames.NetworkTask]: typeof NetworkTask;
    [NetworkExportNames.FetchTask]: typeof FetchTask;
    [NetworkExportNames.HttpRequestType]: typeof HttpRequestType;
    [NetworkExportNames.HttpResponseType]: typeof HttpResponseType;
    [NetworkExportNames.HttpRequestMethod]: typeof HttpRequestMethod;
    [NetworkExportNames.NetworkMessageType]: typeof NetworkMessageType;
};
type BaseExecutionContext = ContextHaving<NetworkDependencies, NetworkExports, BaseContext>;
export type NetworkPackageContext = ContextUsing<[StateEffect], BaseExecutionContext>;
