import { Hono } from 'hono';
import { ServerType } from '@hono/node-server';

type TestHttpServerProtocol = 'http' | 'https';
interface TestHttpServer {
    [Symbol.asyncDispose](): Promise<void>;
    close: () => Promise<void>;
    http: TestHttpServerApi;
    https: TestHttpServerApi;
}
interface TestHttpServerOptions {
    protocols?: Array<TestHttpServerProtocol>;
    hostname?: string;
    defineRoutes?: (router: Hono) => void;
}
interface TestHttpServerApi {
    url: UrlBuilderFunction;
}
interface UrlBuilderFunction {
    (pathname?: string): URL;
}
declare const DEFAULT_PROTOCOLS: Array<TestHttpServerProtocol>;
declare const kApp: unique symbol;
declare const kServer: unique symbol;
declare const kServers: unique symbol;
declare const kEmitter: unique symbol;
/**
 * Create a disposable HTTP server.
 *
 * @example
 * await using server = await createTestHttpServer({
 *   defineRoutes(router) {
 *     router.get('/resource', () => new Response('Hello world!'))
 *   }
 * })
 */
declare function createTestHttpServer(options?: TestHttpServerOptions): Promise<TestHttpServer>;
declare function createUrlBuilder(baseUrl: string | URL, forceRelativePathname?: boolean): UrlBuilderFunction;
declare function toRelativePathname(pathname: string): string;
declare function getServerUrl(protocol: string, server: ServerType): URL;

export { DEFAULT_PROTOCOLS, type TestHttpServer, type TestHttpServerApi, type TestHttpServerOptions, type TestHttpServerProtocol, createTestHttpServer, createUrlBuilder, getServerUrl, kApp, kEmitter, kServer, kServers, toRelativePathname };
