import type { IncomingMessage, ServerResponse } from "node:http";
import type { UiHandlerDeps } from "./deps.js";
export interface ApiError {
    readonly error: {
        readonly code: string;
        readonly message: string;
    };
}
export interface RouteResult {
    readonly status: number;
    readonly body: unknown;
}
export declare const STREAMING: unique symbol;
export type HandlerOutcome = RouteResult | typeof STREAMING;
export interface RouteContext {
    readonly req: IncomingMessage;
    readonly res: ServerResponse;
    readonly params: Readonly<Record<string, string>>;
    readonly url: URL;
}
export type RouteHandler = (ctx: RouteContext, deps: UiHandlerDeps) => HandlerOutcome | Promise<HandlerOutcome>;
export interface RouteDefinition {
    readonly method: string;
    readonly pattern: string;
    readonly handler: RouteHandler;
}
export declare const API_ROUTES: readonly RouteDefinition[];
export interface RouteMatch {
    readonly definition: RouteDefinition;
    readonly params: Readonly<Record<string, string>>;
}
export declare function matchRoute(method: string, pathname: string): RouteMatch | "method-not-allowed" | undefined;
export declare function isApiPath(pathname: string): boolean;
export declare function errorBody(code: string, message: string): ApiError;
export declare function notFoundBody(): ApiError;
export declare function methodNotAllowedBody(): ApiError;
//# sourceMappingURL=routes.d.ts.map