import { type MiddlewarePromise, type SpecialNextParam, type MiddlewareAsync } from '../middlewares/shared.js';
import { MiddlewareCompositeAsync } from '../middlewares/composite-async.js';
import { type Routable, type RouteBuilderArguments } from "./route.js";
import { type UriTemplate } from '../uri-template/index.js';
/**
 * Represents an asynchronous route handler for URI template matching in middleware chains.
 *
 * This middleware class processes routes using URI templates and manages asynchronous middleware execution.
 *
 * @template T - The context type containing the routable request and parameters.
 * @template TSpecialNextParam - The type for special next parameters (defaults to {@link SpecialNextParam})
 */
export declare class MiddlewareRouteAsync<T extends [Routable, ...unknown[]], TSpecialNextParam extends SpecialNextParam = SpecialNextParam> extends MiddlewareCompositeAsync<T, TSpecialNextParam> {
    /**
     * Creates an instance of MiddlewareRouteAsync with a route path or URI template.
     * @template T - The context type containing the routable request and parameters.
     * @template TSpecialNextParam - The type for special next parameters (defaults to SpecialNextParam)
     * @param {string | UriTemplate} route - The route path or URI template defining the route.
     */
    constructor(route: string | UriTemplate);
    /**
     * Parsed URI template used for route matching
     *
     * @type {UriTemplate}
     */
    routePath: UriTemplate;
    /**
     * Creates a new route configuration chain with optional parameters.
     *
     * @function route
     * @param {...RouteBuilderArguments} args - Route configuration parameters (method, path, etc.)
     * @returns {MiddlewareRouteAsync<T, TSpecialNextParam>} Newly created route instance
     */
    route(...args: RouteBuilderArguments): MiddlewareRouteAsync<T, TSpecialNextParam>;
    /**
     * Optional predicate to determine route applicability
     *
     * A function that checks if the route should handle the current request
     *
     * @type {(x: T[0]) => boolean}
     */
    isApplicable?: (x: T[0]) => boolean;
    /**
     * Executes the route's middleware chain asynchronously.
     *
     * @param {...T} context - Execution context containing the routable request and parameters
     * @returns {MiddlewarePromise<TSpecialNextParam>} Resolution promise indicating completion
     */
    handle(...context: T): MiddlewarePromise<TSpecialNextParam>;
    /**
     * Adds middleware to the route chain, supporting route definitions and middleware functions.
     *
     * @function useMiddleware
     * @param {string | UriTemplate | MiddlewareAsync<T, TSpecialNextParam>} routeOrMiddleware -
     *   Either a route definition (string/UriTemplate) or a middleware function
     * @param {...MiddlewareAsync<T, TSpecialNextParam>} middlewares - Additional middleware functions
     * @returns {this} Current middleware instance for method chaining
     */
    useMiddleware(...middlewares: MiddlewareAsync<T, TSpecialNextParam>[]): this;
    useMiddleware(routeOrMiddleware: string | UriTemplate | MiddlewareAsync<T, TSpecialNextParam>, ...middlewares: MiddlewareAsync<T, TSpecialNextParam>[]): this;
    /**
     * Registers route handlers or middleware functions.
     *
     * @function use
     * @param {(string | UriTemplate | ((...args: T) => Promise<unknown>))} routeOrHandler -
     *   Route definition (string/UriTemplate) or handler function
     * @param {...((...args: T) => Promise<unknown>)} handlers - Additional handler functions
     * @returns {this} Current middleware instance for method chaining
     */
    use(routeOrHandler: string | UriTemplate, ...handlers: ((...args: T) => Promise<unknown>)[]): this;
    use(...handlers: ((...args: T) => Promise<unknown>)[]): this;
}
