import { Router } from './Router';
import { Response } from './Response';
import { Request } from './Request';
import { Config, RServerConfig, Url, Method, Callback, Middleware, CallbackOptions, MiddlewareOptions, RouteId, MiddlewareId, ErrorCallback, Env } from '../@types';
import { AddressInfo } from 'net';
import { Wrapper } from './Wrapper';
export interface AppConstructorOptions<Rq extends Request = Request, Rs extends Response = Response> {
    configFile?: string;
    config?: Config;
    Request?: Rs;
    Response?: Rq;
}
export declare class App<Rq extends Request = Request, Rs extends Response = Response> {
    private constructOptions;
    private httpServer;
    private httpsServer;
    private entryPath;
    private config;
    private router;
    private mountedRouters;
    private logger;
    private bodyParser;
    private errorCallback;
    constructor(options?: AppConstructorOptions<Rq, Rs>);
    createServers(): void;
    /**
     * returns the env variable
     */
    get env(): Env;
    /**
     * load env settings
     */
    private loadEnv;
    /**
     * resolves and merges the configuration objects
     */
    private resolveConfig;
    /**
     * returns server intro
     */
    private getServerIntro;
    /**
     * runs the array of route instances until a matched route is found
     */
    private runRoutes;
    /**
     * cordinates how routes are executed, including mounted routes
     */
    private cordinateRoutes;
    /**
     * perform house keeping
     */
    private onResponseFinish;
    /**
     * parse all request data
     */
    private parseRequestData;
    /**
     * handle onrequest end event
     */
    private onRequestEnd;
    /**
     * handle on request error event
     */
    private onRequestError;
    /**
     * handle request data event
     */
    private onRequestData;
    /**
     * handles onrequest events
     */
    private onRequest;
    /**
     * binds all event handlers on the server
     */
    private closeServer;
    /**
     * binds all event handlers on the server
     */
    private initServer;
    /**
     * returns boolean indicating if the server is listening
     */
    get listening(): boolean;
    /**
     * returns the server instance router
     */
    getRouter(): Router;
    /**
     * returns the server instance mounted routers
     */
    getMountedRouters(): Router[];
    /**
     * returns the resolved server config object
     */
    getConfig(): RServerConfig;
    /**
     * sets routing base path that gets prepended to all route and middleware urls
     */
    setBasePath(basePath: string): void;
    /**
     * sets the app intance callback error handler
     * @param errorCallback app instance error callback
     */
    setErrorCallback(errorCallback: ErrorCallback): void;
    /**
     * stores route rules for http OPTIONS method
     *
     * @param url - route url
     * @param callback - route callback handler
     * @param options - route configuration object or middleware or array of middlewares
     */
    options(url: Url, callback: Callback, options?: Middleware | Middleware[] | CallbackOptions): number;
    /**
     * stores route rules for http HEAD method
     *
     * @param url - route url
     * @param callback - route callback handler
     * @param options - route configuration object or middleware or array of middlewares
     */
    head(url: Url, callback: Callback, options?: Middleware | Middleware[] | CallbackOptions): number;
    /**
     * stores route rules for http GET method
     *
     * @param url - route url
     * @param callback - route callback handler
     * @param options - route configuration object or middleware or array of middlewares
     */
    get(url: Url, callback: Callback, options?: Middleware | Middleware[] | CallbackOptions): number;
    /**
     * stores route rules for http POST method
     *
     * @param url - route url
     * @param callback - route callback handler
     * @param options - route configuration object or middleware or array of middlewares
     */
    post(url: Url, callback: Callback, options?: Middleware | Middleware[] | CallbackOptions): number;
    /**
     * stores route rules for http PUT method
     * @param url - route url
     * @param callback - route callback handler
     * @param options - route configuration object or middleware or array of middlewares
     */
    put(url: Url, callback: Callback, options?: Middleware | Middleware[] | CallbackOptions): number;
    /**
     * stores route rules for http DELETE method
     *
     * @param url - route url
     * @param callback - route callback handler
     * @param options - route configuration object or middleware or array of middlewares
     */
    delete(url: Url, callback: Callback, options?: Middleware | Middleware[] | CallbackOptions): number;
    /**
     * stores route rules for all http methods
     *
     * @param url - route url
     * @param callback - route callback handler
     * @param options - route configuration object or middleware or array of middlewares
     */
    any(url: Url, callback: Callback, options?: Middleware | Middleware[] | CallbackOptions): void;
    /**
     * returns a route wrapper for the given url
     */
    route(url: Url): Wrapper;
    /**
     * removes a given route
     * @param id route id
     */
    removeRoute(id: RouteId): boolean;
    /**
     * removes a given middleware
     * @param id middleware id
     */
    removeMiddleware(id: MiddlewareId): boolean;
    /**
     * registers a middleware to be called whenever the given url is visited
     *
     * @param url - url to apply middleware to. use * to appy to all urls
     * @param middleware - the middleware or array of middlewares
     * @param options - middleware configuration option. here, you can specify the http method
     * that the middleware will run against
     */
    use(url: Url, middleware: Middleware | Middleware[], options?: Method | Method[] | MiddlewareOptions): number;
    /**
     * mounts a router to the server instance
     */
    mount(baseUrl: Url, router: Router): void;
    /**
     * starts the server at a given port
     */
    listen(port?: number | {
        httpPort?: number;
        httpsPort?: number;
    }): Promise<unknown>;
    /**
     * closes server
     * @param callback callback function to execute when connection closes
     */
    close(): Promise<boolean>;
    /**
     * returns http and https server address
     */
    address(): {
        http: AddressInfo | null;
        https: AddressInfo | null;
    };
}
