import { ReadonlySignal } from "@preact/signals";
export type NavigationState = Record<string, unknown>;
export interface QueryParams {
    [key: string]: string;
}
/**
 * Interface for NavigationHistoryEntry based on the Navigation API
 */
export interface NavigationHistoryEntry {
    url: string;
    key: string;
    id: string;
    index: number;
    sameDocument: boolean;
    state?: any;
    hash: string;
}
/**
   * Simplified NavigateEvent interface based on the Navigation API
   */
export interface NavigateEvent extends Event {
    destination: NavigationHistoryEntry;
    canIntercept: boolean;
    intercept: (options?: {
        handler?: () => Promise<void> | void;
    }) => void;
    scroll: () => void;
}
/**
   * NavigationOptions interface based on the Navigation API
   */
export interface NavigationOptions {
    state?: unknown;
    info?: unknown;
}
export interface HashNavigation {
    currentEntry: ReadonlySignal<NavigationHistoryEntry>;
    prevEntry: ReadonlySignal<NavigationHistoryEntry | null>;
    entries: ReadonlySignal<NavigationHistoryEntry[]>;
    canGoBack: ReadonlySignal<boolean>;
    canGoForward: ReadonlySignal<boolean>;
    navigate: (hash: string, options?: NavigationOptions) => void;
    traverseTo: (key: string, options?: NavigationOptions) => void;
    back: VoidFunction;
    goToPrev: VoidFunction;
    forward: VoidFunction;
    updateCurrentEntry: (options?: NavigationOptions, hash?: string) => void;
    subscribe: (callback: (entry: NavigationHistoryEntry, prevEntry: NavigationHistoryEntry | null, hash: string) => void) => VoidFunction;
    create: () => void;
    destroy: () => void;
    updateCurrentEntryHash: (hash: string, newState?: NavigationState | null | undefined) => void;
}
/**
 * router interfaces
 */
export interface InitializeRouterConfig {
    homeUrl: string;
    routeNames: string[];
}
export type NavigationCb = (entry: NavigationHistoryEntry, prev: NavigationHistoryEntry | null, navigationStatus: 'success' | 'notfound') => void;
export interface SubscribeChangeConfig {
    onChange: NavigationCb;
    config: InitializeRouterConfig;
}
export interface RouterHistoryEntry extends NavigationHistoryEntry {
    pattern?: string;
    getParams: <T extends Record<string, string> = Record<string, string>>() => T;
    getQuery: <T extends QueryParams>() => T;
}
export interface HashRouter extends Pick<HashNavigation, 'entries' | 'canGoBack' | 'canGoForward'> {
    _navigation: HashNavigation;
    currentEntry: ReadonlySignal<RouterHistoryEntry>;
    prevEntry: ReadonlySignal<NavigationHistoryEntry | null>;
    state: ReadonlySignal<NavigationState>;
    hash: ReadonlySignal<string>;
    create: (config: SubscribeChangeConfig) => VoidFunction;
    subscribe: (callback: NavigationCb) => VoidFunction;
    navigate: (hash: string, state?: Record<string, unknown>) => void;
    replaceState: (config?: {
        state?: Record<string, unknown>;
        hash?: string;
    }) => void;
    goBack: VoidFunction;
    goToPrev: VoidFunction;
    getHash: () => string;
    getState: <T = NavigationState>() => T | undefined;
    hasPage: (hash?: string) => boolean;
    destroy: VoidFunction;
    getConfig: () => InitializeRouterConfig | null;
}
export type RouteComponent = React.ComponentType<any>;
export interface ClientRouterProps {
    className?: string;
    /** Instance of the hash router */
    router: HashRouter;
    /** Map of route paths to React components */
    routes: Record<string, RouteComponent>;
    homeUrl: string;
    /** Component to render when route is not found */
    notFoundComponent: RouteComponent;
}
//# sourceMappingURL=types.d.ts.map