import { ClientServerChannel, Serializable, SerializedProxyConfig } from "../../serialization/serialization";
import { Explainable, Headers } from "../../types";
import { ProxyConfig } from '../proxy-config';
import { PassThroughStepConnectionOptions, ForwardingOptions, PassThroughLookupOptions, CADefinition, PassThroughInitialTransforms } from '../passthrough-handling-definitions';
import { CloseConnectionStep, DelayStep, ResetConnectionStep, TimeoutStep, WaitForRequestBodyStep } from '../requests/request-step-definitions';
import { Replace } from '../../util/type-utils';
import { SerializedMatchReplacePairs } from '../match-replace';
/**
 * The definition of a websocket rule step, which can be passed to Mockttp to define
 * a rule.
 *
 * Implementation of the step is not included in the definition classes, but
 * instead exists in an *Impl class defined separately and used internally.
 */
export interface WebSocketStepDefinition extends Explainable, Serializable {
    type: keyof typeof WsStepDefinitionLookup;
}
export interface PassThroughWebSocketStepOptions extends PassThroughStepConnectionOptions {
    transformRequest?: WebSocketRequestTransform;
}
export interface WebSocketRequestTransform extends PassThroughInitialTransforms {
    /**
     * Override the request protocol. If replaceHost & matchReplaceHost are not specified
     * and the URL no explicitly specified port, this will automatically switch to the
     * appropriate port (e.g. from 80 to 443).
     */
    setProtocol?: 'ws' | 'wss';
}
/**
 * @internal
 */
export interface SerializedPassThroughWebSocketData {
    type: 'ws-passthrough';
    forwarding?: ForwardingOptions;
    lookupOptions?: PassThroughLookupOptions;
    proxyConfig?: SerializedProxyConfig;
    simulateConnectionErrors?: boolean;
    ignoreHostCertificateErrors?: string[] | boolean;
    extraCACertificates?: Array<{
        cert: string;
    } | {
        certPath: string;
    }>;
    clientCertificateHostMap?: {
        [host: string]: {
            pfx: string;
            passphrase?: string;
        };
    };
    transformRequest?: Replace<WebSocketRequestTransform, {
        'matchReplaceHost'?: {
            replacements: SerializedMatchReplacePairs;
            updateHostHeader?: boolean | string;
        };
        'matchReplacePath'?: SerializedMatchReplacePairs;
        'matchReplaceQuery'?: SerializedMatchReplacePairs;
    }>;
}
export declare class PassThroughWebSocketStep extends Serializable implements WebSocketStepDefinition {
    readonly type = "ws-passthrough";
    static readonly isFinal = true;
    readonly lookupOptions: PassThroughLookupOptions | undefined;
    readonly proxyConfig?: ProxyConfig;
    readonly simulateConnectionErrors: boolean;
    readonly ignoreHostHttpsErrors: string[] | boolean;
    readonly clientCertificateHostMap: {
        [host: string]: {
            pfx: Buffer;
            passphrase?: string;
        };
    };
    readonly extraCACertificates: Array<CADefinition>;
    readonly transformRequest?: WebSocketRequestTransform;
    constructor(options?: PassThroughWebSocketStepOptions);
    explain(): string;
    /**
     * @internal
     */
    serialize(channel: ClientServerChannel): SerializedPassThroughWebSocketData;
}
export declare class EchoWebSocketStep extends Serializable implements WebSocketStepDefinition {
    readonly type = "ws-echo";
    static readonly isFinal = true;
    explain(): string;
}
export declare class ListenWebSocketStep extends Serializable implements WebSocketStepDefinition {
    readonly type = "ws-listen";
    static readonly isFinal = true;
    explain(): string;
}
export declare class RejectWebSocketStep extends Serializable implements WebSocketStepDefinition {
    readonly statusCode: number;
    readonly statusMessage: string;
    readonly headers: Headers;
    readonly body: Buffer | string;
    readonly type = "ws-reject";
    static readonly isFinal = true;
    constructor(statusCode: number, statusMessage?: string, headers?: Headers, body?: Buffer | string);
    explain(): string;
}
export { CloseConnectionStep, ResetConnectionStep, TimeoutStep, DelayStep, WaitForRequestBodyStep };
export declare const WsStepDefinitionLookup: {
    'ws-passthrough': typeof PassThroughWebSocketStep;
    'ws-echo': typeof EchoWebSocketStep;
    'ws-listen': typeof ListenWebSocketStep;
    'ws-reject': typeof RejectWebSocketStep;
    'close-connection': typeof CloseConnectionStep;
    'reset-connection': typeof ResetConnectionStep;
    timeout: typeof TimeoutStep;
    delay: typeof DelayStep;
    'wait-for-request-body': typeof WaitForRequestBodyStep;
};
//# sourceMappingURL=websocket-step-definitions.d.ts.map