import { Pathfinder, RouteParams } from '@sigiljs/pathfinder';
import { default as Sigil } from '../sigil/sigil';
import { Internal } from '../types';
import { ILogOptions } from '../utils/make-log';
import { ModifierConstructor } from './modifier';
import { default as Route, RouteOptions } from './route';
type X<Middleware> = Middleware extends readonly ModifierConstructor<any, any>[] ? InstanceType<Middleware[number]> : never;
/**
 * Core router class that serves as a higher-level abstraction over the
 * underlying HTTP router (pathfinder). Provides foundational logic for:
 * - Mounting child routers
 * - Storing request metadata and validation schemas
 * - Managing middleware modifiers and debug logging
 *
 * @template Middleware A tuple of modifier constructors applied to this route.
 */
export default class RouteCore<Middleware extends (readonly ModifierConstructor<any, any>[]) | undefined> {
    protected readonly $pathfinder: Pathfinder;
    /**
     * Bound logger function configured with route-level debug options.
     */
    readonly logger: (options: ILogOptions) => void;
    /**
     * Router-level configuration options (e.g., debug settings).
     */
    protected __$options?: RouteOptions<any>;
    protected __$sigil?: Sigil;
    /**
     * Reference to the root Route when chaining definitions.
     * Used to aggregate child request metadata.
     * @protected
     */
    protected __initialParent?: Route<any>;
    /**
     * Map of registered request descriptors for this router.
     * Keyed by a unique identifier.
     * @protected
     */
    protected $registeredRequests: Map<string, Internal.Route.RequestDescriptor>;
    /**
     * Instantiated middleware modifiers for this router.
     * @protected
     */
    protected $modifierInstances: X<Middleware>[];
    /**
     * @protected
     */
    protected $modifierConstructors: readonly ModifierConstructor<any, any>[];
    /**
     * Callback invoked whenever the router's structure is updated.
     * @protected
     */
    protected $updateCallback?: () => any;
    /**
     * Map of mounted child routers by mount path.
     * @private
     */
    private $mounted;
    /**
     * Initializes the RouteCore.
     *
     * @param modifiers array of modifier constructors to apply, or undefined.
     * @param $pathfinder underlying pathfinder router instance.
     * @param $options optional router settings (excluding modifiers).
     * @protected
     */
    protected constructor(modifiers: (readonly ModifierConstructor<any, any>[]) | undefined, $pathfinder: Pathfinder, $options?: RouteOptions<Middleware>);
    /**
     * Retrieve route options
     */
    get routeOptions(): RouteOptions<any> | undefined;
    /**
     * Accessor for all registered request descriptors,
     * including those from mounted child routers with full paths.
     */
    get exportRequests(): Internal.Route.RequestDescriptor[];
    /**
     * Mounts a child router at the specified sub-path.
     * Propagates update callbacks to maintain global request metadata.
     *
     * @param path sub-path at which to mount the child router.
     * @param route child Route instance.
     */
    mount(path: string, route: Route<any>): void;
    /**
     * Applies all middleware modifiers to the incoming client request.
     * Merges each modifier's output into the request object.
     *
     * @param req - The parsed client request to modify.
     * @returns The modified request with merged modifier payloads.
     * @protected
     */
    protected $injectModifier(req: Internal.Requests.ClientRequest<RouteParams<string>>): Promise<Internal.Requests.ClientRequest<RouteParams<string>, unknown, unknown, unknown>>;
    /**
     * Initialize or re-initialize modifier instances
     * @private
     */
    private initializeModifiers;
}
export {};
