import * as plugins from '../plugins.js';
import type { IRoute, IMergedRoute, IRouteWarning, IRouteMetadata } from '../../dist_ts_interfaces/data/route-management.js';
import type { IDcRouterRouteConfig } from '../../dist_ts_interfaces/data/remoteingress.js';
import { type IHttp3Config } from '../http3/index.js';
import type { ReferenceResolver } from './classes.reference-resolver.js';
export type TVpnClientAllowEntry = string | {
    clientId: string;
    domains: string[];
};
export interface IRouteMutationResult {
    success: boolean;
    message?: string;
}
export declare class RouteConfigManager {
    private getSmartProxy;
    private getHttp3Config?;
    private getVpnClientAccessForRoute?;
    private referenceResolver?;
    private onRoutesApplied?;
    private getRuntimeRoutes?;
    private hydrateStoredRoute?;
    private routes;
    private warnings;
    private routeUpdateMutex;
    constructor(getSmartProxy: () => plugins.smartproxy.SmartProxy | undefined, getHttp3Config?: (() => IHttp3Config | undefined) | undefined, getVpnClientAccessForRoute?: ((route: IDcRouterRouteConfig, routeId?: string) => TVpnClientAllowEntry[]) | undefined, referenceResolver?: ReferenceResolver | undefined, onRoutesApplied?: ((routes: plugins.smartproxy.IRouteConfig[]) => void | Promise<void>) | undefined, getRuntimeRoutes?: (() => plugins.smartproxy.IRouteConfig[]) | undefined, hydrateStoredRoute?: ((storedRoute: IRoute) => plugins.smartproxy.IRouteConfig | undefined) | undefined);
    /** Expose routes map for reference resolution lookups. */
    getRoutes(): Map<string, IRoute>;
    getRoute(id: string): IRoute | undefined;
    setVpnClientAccessResolver(resolver?: (route: IDcRouterRouteConfig, routeId?: string) => TVpnClientAllowEntry[]): void;
    /**
     * Load persisted routes, seed serializable config/email/dns routes,
     * compute warnings, and apply the combined DB-backed + runtime route set to SmartProxy.
     */
    initialize(configRoutes?: IDcRouterRouteConfig[], emailRoutes?: IDcRouterRouteConfig[], dnsRoutes?: IDcRouterRouteConfig[]): Promise<void>;
    getMergedRoutes(): {
        routes: IMergedRoute[];
        warnings: IRouteWarning[];
    };
    createRoute(route: IDcRouterRouteConfig, createdBy: string, enabled?: boolean, metadata?: IRouteMetadata): Promise<string>;
    updateRoute(id: string, patch: {
        route?: Partial<IDcRouterRouteConfig>;
        enabled?: boolean;
        metadata?: Partial<IRouteMetadata>;
    }): Promise<IRouteMutationResult>;
    deleteRoute(id: string): Promise<IRouteMutationResult>;
    toggleRoute(id: string, enabled: boolean): Promise<IRouteMutationResult>;
    findApiRouteByExternalKey(externalKey: string): IRoute | undefined;
    /**
     * Upsert seed routes by name+origin. Preserves user's `enabled` state.
     * Deletes stale DB routes whose origin matches but name is not in the seed set.
     */
    private seedRoutes;
    private buildSystemRouteKey;
    private findExistingSeedRouteId;
    private loadRoutes;
    private persistRoute;
    private normalizeRouteMetadata;
    private computeWarnings;
    private logWarnings;
    /**
     * Re-resolve specific routes by ID (after a profile or target is updated).
     * Persists each route and calls applyRoutes() once at the end.
     */
    reResolveRoutes(routeIds: string[]): Promise<void>;
    applyRoutes(): Promise<void>;
    private prepareStoredRouteForApply;
    private prepareRouteForApply;
    private injectVpnSecurity;
    private mergeVpnClientAllowEntries;
}
