import type { MojoContext, PlaceholderType } from './types.js';
import { Cache } from './cache.js';
import { Plan } from './router/plan.js';
import { Route } from './router/route.js';
type RouteIndex = Record<string, Route>;
interface RouteSpec {
    ctx?: MojoContext;
    method: string;
    path: string;
    websocket: boolean;
}
type RouteCondition = (ctx: MojoContext, requirements: any) => Promise<boolean>;
/**
 * Router class.
 */
export declare class Router extends Route {
    /**
     * Routing cache.
     */
    cache: Cache<Plan> | null;
    /**
     * Contains all available conditions.
     */
    conditions: Record<string, RouteCondition>;
    /**
     * Directories to look for controllers in, first one has the highest precedence.
     */
    controllerPaths: string[];
    /**
     * Already loaded controllers.
     */
    controllers: Record<string, any>;
    /**
     * Registered placeholder types, by default only `num` is already defined.
     */
    types: Record<string, PlaceholderType>;
    _lookupIndex: RouteIndex | undefined;
    constructor();
    /**
     * Register a condition.
     */
    addCondition(name: string, fn: RouteCondition): this;
    /**
     * Register a placeholder type.
     */
    addType(name: string, value: PlaceholderType): this;
    /**
     * Match routes and dispatch to actions with and without controllers.
     */
    dispatch(ctx: MojoContext): Promise<boolean>;
    /**
     * Find child route by name, custom names have precedence over automatically generated ones.
     */
    find(name: string): Route | null;
    /**
     * Find route by name and cache all results for future lookups.
     */
    lookup(name: string): Route | null;
    /**
     * Plot a route.
     */
    plot(spec: RouteSpec): Promise<Plan | null>;
    /**
     * Prepare controllers for routing.
     */
    warmup(): Promise<void>;
    _getPlan(ctx: MojoContext): Promise<Plan | null>;
    _getLookupIndex(): RouteIndex;
    _walk(plan: Plan, route: Route, spec: RouteSpec): Promise<boolean>;
}
export {};
