import { type Server, type ServerResponse } from 'node:http';
import type { BaseAppConfig } from '../app/config';
import type { ScopedLogger } from '../services';
import { type HttpCorsConfig } from './cors';
import { HttpRequest } from './request';
import { MemoryHttpResponse, type HttpResponse } from './response';
import { HttpRouter } from './router';
import { type HttpRequestLoggingOptions } from './request-logging';
import { type StaticFilesOptions } from './static-files';
import { type HttpUpgradeHandler } from './upgrade';
export interface HttpServerRuntimeOptions<C extends BaseAppConfig = BaseAppConfig> {
    config: C;
    router: HttpRouter;
    logger: ScopedLogger;
    frameworkConfig?: Record<string, unknown>;
    serverConfig?: Record<string, unknown>;
    cors?: HttpCorsConfig<C>;
    staticFiles?: boolean | StaticFilesOptions;
    requestLogging?: HttpRequestLoggingOptions;
    packageName?: string;
    devConsoleEnabled?: boolean;
    listenHooks?: HttpServerListenHooks | (() => HttpServerListenHooks);
}
export interface HttpServerListenHooks {
    start?: () => Promise<void>;
    afterListen?: (server: Server) => Promise<void>;
    onListenError?: (error: unknown) => Promise<void>;
}
export interface HttpRequestObservation {
    request: HttpRequest;
    response: HttpResponse;
    startedAt: number;
    durationMs: number;
    error?: unknown;
}
export type HttpRequestObserver = (entry: HttpRequestObservation) => void;
export declare class HttpServerRuntime<C extends BaseAppConfig = BaseAppConfig> {
    private readonly options;
    private readonly corsOptions;
    private readonly staticFiles?;
    private readonly appLogger;
    private readonly requestLogger;
    private readonly upgradeHandlers;
    private readonly observers;
    private server?;
    constructor(options: HttpServerRuntimeOptions<C>);
    request(request: HttpRequest, response?: HttpResponse): Promise<HttpResponse>;
    listen(port?: number, host?: string, hooks?: HttpServerListenHooks): Promise<Server>;
    registerUpgradeHandler(handler: HttpUpgradeHandler): () => void;
    registerObserver(observer: HttpRequestObserver): () => void;
    close(): Promise<void>;
    private notifyObservers;
    getPort(explicitPort?: number): number;
    private shouldLogStartupDetails;
    private handleNodeRequest;
}
export declare function writeNodeResponse(outgoing: ServerResponse, response: MemoryHttpResponse): void;
export declare function writeUnhandledNodeError(outgoing: ServerResponse, error: unknown): void;
//# sourceMappingURL=base.d.ts.map