/// <reference types="node" />
import { RequestMethod, VersioningOptions } from '@nestjs/common';
import { VersionValue } from '@nestjs/common/interfaces';
import { CorsOptions, CorsOptionsDelegate } from '@nestjs/common/interfaces/external/cors-options.interface';
import { AbstractHttpAdapter } from '@nestjs/core/adapters/http-adapter';
import { FastifyInstance, FastifyLoggerInstance, FastifyPluginAsync, FastifyPluginCallback, FastifyReply, FastifyRequest, FastifyServerOptions, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault, RequestGenericInterface } from 'fastify';
import * as http2 from 'http2';
import * as https from 'https';
import { Chain as LightMyRequestChain, InjectOptions, Response as LightMyRequestResponse } from 'light-my-request';
import { FastifyStaticOptions, PointOfViewOptions } from '../interfaces/external';
declare type FastifyHttp2SecureOptions<Server extends http2.Http2SecureServer, Logger extends FastifyLoggerInstance = FastifyLoggerInstance> = FastifyServerOptions<Server, Logger> & {
    http2: true;
    https: http2.SecureServerOptions;
};
declare type FastifyHttp2Options<Server extends http2.Http2Server, Logger extends FastifyLoggerInstance = FastifyLoggerInstance> = FastifyServerOptions<Server, Logger> & {
    http2: true;
    http2SessionTimeout?: number;
};
declare type FastifyHttpsOptions<Server extends https.Server, Logger extends FastifyLoggerInstance = FastifyLoggerInstance> = FastifyServerOptions<Server, Logger> & {
    https: https.ServerOptions;
};
declare type VersionedRoute = Function & {
    version: VersionValue;
    versioningOptions: VersioningOptions;
};
/**
 * The following type assertion is valid as we enforce "middie" plugin registration
 * which enhances the FastifyRequest.RawRequest with the "originalUrl" property.
 * ref https://github.com/fastify/middie/pull/16
 * ref https://github.com/fastify/fastify/pull/559
 */
declare type FastifyRawRequest<TServer extends RawServerBase> = RawRequestDefaultExpression<TServer> & {
    originalUrl?: string;
};
export declare class FastifyAdapter<TServer extends RawServerBase = RawServerDefault, TRawRequest extends FastifyRawRequest<TServer> = FastifyRawRequest<TServer>, TRawResponse extends RawReplyDefaultExpression<TServer> = RawReplyDefaultExpression<TServer>, TRequest extends FastifyRequest<RequestGenericInterface, TServer, TRawRequest> = FastifyRequest<RequestGenericInterface, TServer, TRawRequest>, TReply extends FastifyReply<TServer, TRawRequest, TRawResponse> = FastifyReply<TServer, TRawRequest, TRawResponse>, TInstance extends FastifyInstance<TServer, TRawRequest, TRawResponse> = FastifyInstance<TServer, TRawRequest, TRawResponse>> extends AbstractHttpAdapter<TServer, TRequest, TReply> {
    protected readonly instance: TInstance;
    private _isParserRegistered;
    private isMiddieRegistered;
    private versioningOptions;
    private readonly versionConstraint;
    get isParserRegistered(): boolean;
    constructor(instanceOrOptions?: TInstance | FastifyHttp2Options<any> | FastifyHttp2SecureOptions<any> | FastifyHttpsOptions<any> | FastifyServerOptions<TServer>);
    init(): Promise<void>;
    listen(port: string | number, callback?: () => void): void;
    listen(port: string | number, hostname: string, callback?: () => void): void;
    get(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    post(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    head(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    delete(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    put(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    patch(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    options(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    applyVersionFilter(handler: Function, version: VersionValue, versioningOptions: VersioningOptions): VersionedRoute;
    reply(response: TRawResponse | TReply, body: any, statusCode?: number): FastifyReply<TServer, TRawRequest, TRawResponse, import("fastify/types/route").RouteGenericInterface, unknown>;
    status(response: TRawResponse | TReply, statusCode: number): TRawResponse | FastifyReply<TServer, TRawRequest, TRawResponse, import("fastify/types/route").RouteGenericInterface, unknown>;
    render(response: TReply & {
        view: Function;
    }, view: string, options: any): any;
    redirect(response: TReply, statusCode: number, url: string): FastifyReply<TServer, TRawRequest, TRawResponse, import("fastify/types/route").RouteGenericInterface, unknown>;
    setErrorHandler(handler: Parameters<TInstance['setErrorHandler']>[0]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    setNotFoundHandler(handler: Function): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance>;
    getHttpServer<T = TServer>(): T;
    getInstance<T = TInstance>(): T;
    register<TRegister extends Parameters<TInstance['register']>>(plugin: TRegister['0'], opts?: TRegister['1']): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
    inject(): LightMyRequestChain;
    inject(opts: InjectOptions | string): Promise<LightMyRequestResponse>;
    close(): Promise<undefined>;
    initHttpServer(): void;
    useStaticAssets(options: FastifyStaticOptions): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
    setViewEngine(options: PointOfViewOptions | string): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
    setHeader(response: TReply, name: string, value: string): FastifyReply<TServer, TRawRequest, TRawResponse, import("fastify/types/route").RouteGenericInterface, unknown>;
    getRequestHostname(request: TRequest): string;
    getRequestMethod(request: TRequest): string;
    getRequestUrl(request: TRequest): string;
    getRequestUrl(request: TRawRequest): string;
    enableCors(options: CorsOptions | CorsOptionsDelegate<TRequest>): void;
    registerParserMiddleware(): void;
    createMiddlewareFactory(requestMethod: RequestMethod): Promise<(path: string, callback: Function) => any>;
    getType(): string;
    protected registerWithPrefix(factory: FastifyPluginCallback<any> | FastifyPluginAsync<any> | Promise<{
        default: FastifyPluginCallback<any>;
    }> | Promise<{
        default: FastifyPluginAsync<any>;
    }>, prefix?: string): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyLoggerInstance> & PromiseLike<undefined>;
    private isNativeResponse;
    private registerMiddie;
    private getRequestOriginalUrl;
    private injectConstraintsIfVersioned;
}
export {};
