import { RequestHandler } from '@hattip/compose';
import { HattipHandler as HattipHandler$1, AdapterRequestContext } from '@hattip/core';
import { Get, UniversalHandler, UniversalFn, UniversalMiddleware, RuntimeAdapter, UniversalRouter, UniversalRouterInterface, EnhancedMiddleware } from '@universal-middleware/core';
import { Router } from '@hattip/router';

declare const contextSymbol: unique symbol;
declare module "@hattip/core" {
    interface AdapterRequestContext {
        [contextSymbol]?: Universal.Context;
    }
}
type HattipHandler<In extends Universal.Context> = UniversalFn<UniversalHandler<In>, HattipHandler$1>;
type HattipMiddleware<In extends Universal.Context, Out extends Universal.Context> = UniversalFn<UniversalMiddleware<In, Out>, RequestHandler>;
/**
 * Creates a request handler to be passed to hattip
 */
declare function createHandler<T extends unknown[], InContext extends Universal.Context>(handlerFactory: Get<T, UniversalHandler<InContext>>): Get<T, HattipHandler<InContext>>;
/**
 * Creates a middleware to be passed to @hattip/compose or @hattip/router
 */
declare function createMiddleware<T extends unknown[], InContext extends Universal.Context, OutContext extends Universal.Context>(middlewareFactory: Get<T, UniversalMiddleware<InContext, OutContext>>): Get<T, HattipMiddleware<InContext, OutContext>>;
declare function getContext<InContext extends Universal.Context = Universal.Context>(context: AdapterRequestContext): InContext;
declare function getRuntime(context: AdapterRequestContext): RuntimeAdapter;

declare class UniversalHattipRouter extends UniversalRouter implements UniversalRouterInterface {
    #private;
    constructor(app: Router);
    use(middleware: EnhancedMiddleware): this;
    applyCatchAll(): this;
}
declare function apply(app: Router, middlewares: EnhancedMiddleware[]): void;

export { type HattipHandler, type HattipMiddleware, UniversalHattipRouter, apply, createHandler, createMiddleware, getContext, getRuntime };
