import { Writable } from 'node:stream';
import { Context, APIGatewayProxyEventV2 } from 'aws-lambda';
import { APIGatewayProxyStructuredResultV2 } from 'aws-lambda/trigger/api-gateway-proxy';
import { B as BinarySettings, S as ServerlessHandler } from '../../handler.contract-Ckhqvom_.js';
import { A as AdapterContract, R as ResolverContract, a as AdapterRequest } from '../../adapter.contract-FnS-TPRj.js';
import { F as FrameworkContract } from '../../framework.contract-td-lRvq6.js';
import { B as BaseHandler } from '../../base-handler-DTcqjFpI.js';
import { I as ILogger } from '../../logger-F8qccesk.js';
import '../../headers-DjfGHDmI.js';
import 'http';
import 'node:http';
import '../../request-DI51fiy-.js';

/**
 * @breadcrumb Handlers / AwsStreamHandler
 * @public
 */
type AWSResponseStream = Writable;
/**
 * @breadcrumb Handlers / AwsStreamHandler
 * @public
 */
type AWSStreamResponseMetadata = Pick<APIGatewayProxyStructuredResultV2, 'statusCode' | 'headers' | 'cookies'>;
/**
 * The interface that customizes the {@link AwsStreamHandler}
 *
 * @breadcrumb Handlers / AwsStreamHandler
 * @public
 */
type AwsStreamHandlerOptions = {
    /**
     * Set the value of the property `callbackWaitsForEmptyEventLoop`, you can set to `false` to fix issues with long execution due to not cleaning the event loop ([ref](https://github.com/H4ad/serverless-adapter/issues/264)).
     * In the next release, this value will be changed to `false`.
     *
     * @defaultValue undefined
     */
    callbackWaitsForEmptyEventLoop?: boolean;
};
/**
 * The interface that describes the internal context used by the {@link AwsStreamHandler}
 *
 * @breadcrumb Handlers / AwsStreamHandler
 * @public
 */
type AWSStreamContext = {
    /**
     * The response stream provided by the serverless
     */
    response: AWSResponseStream;
    /**
     * The context provided by the serverless
     */
    context: Context;
};
/**
 * The class that implements a default serverless handler consisting of a function with event, context and callback parameters respectively
 *
 * @breadcrumb Handlers / AwsStreamHandler
 * @public
 */
declare class AwsStreamHandler<TApp> extends BaseHandler<TApp, APIGatewayProxyEventV2, AWSStreamContext, void, AWSStreamResponseMetadata, void> {
    private readonly options?;
    /**
     * Construtor padrão
     */
    constructor(options?: AwsStreamHandlerOptions | undefined);
    /**
     * {@inheritDoc}
     */
    getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<APIGatewayProxyEventV2, AWSStreamContext, AWSStreamResponseMetadata>[], _resolverFactory: ResolverContract<unknown, unknown, unknown, unknown, unknown>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<Promise<void>>;
    /**
     * The hook executed on receive a request, before the request is being processed
     *
     * @param log - The instance of logger
     * @param event - The event sent by serverless
     * @param context - The context sent by serverless
     * @param binarySettings - The binary settings
     * @param respondWithErrors - Indicates whether the error stack should be included in the response or not
     */
    protected onReceiveRequest(log: ILogger, event: APIGatewayProxyEventV2, context: AWSStreamContext, binarySettings: BinarySettings, respondWithErrors: boolean): void;
    /**
     * The hook executed after resolve the adapter that will be used to handle the request and response
     *
     * @param log - The instance of logger
     * @param adapter - The adapter resolved
     */
    protected onResolveAdapter(log: ILogger, adapter: AdapterContract<APIGatewayProxyEventV2, AWSStreamContext, AWSStreamResponseMetadata>): void;
    /**
     * The hook executed after resolves the request values that will be sent to the framework
     *
     * @param log - The instance of logger
     * @param requestValues - The request values returned by the adapter
     */
    protected onResolveRequestValues(log: ILogger, requestValues: AdapterRequest): void;
    /**
     * The hook executed before sending response to the serverless with response from adapter
     *
     * @param log - The instance of logger
     * @param successResponse - The success response resolved by the adapter
     */
    protected onForwardResponseAdapterResponse(log: ILogger, successResponse: AWSStreamResponseMetadata): void;
    /**
     * The function to forward the event to the framework
     *
     * @param app - The instance of the app (express, hapi, etc...)
     * @param framework - The framework that will process requests
     * @param event - The event sent by serverless
     * @param context - The context sent by serverless
     * @param adapter - The adapter resolved to this event
     * @param _binarySettings - The binary settings
     * @param log - The instance of logger
     */
    protected forwardRequestToFramework(app: TApp, framework: FrameworkContract<TApp>, event: APIGatewayProxyEventV2, context: AWSStreamContext, adapter: AdapterContract<APIGatewayProxyEventV2, AWSStreamContext, AWSStreamResponseMetadata>, _binarySettings: BinarySettings, log: ILogger): Promise<void>;
}

export { type AWSResponseStream, type AWSStreamContext, type AWSStreamResponseMetadata, AwsStreamHandler, type AwsStreamHandlerOptions };
