/**
 * UI Bridge Native Provider
 *
 * React context provider for UI Bridge Native functionality.
 */
import React from 'react';
import type { NativeUIBridgeFeatures, NativeUIBridgeConfig, RegisteredNativeElement, RegisteredNativeComponent, NativeBridgeSnapshot, BridgeEventType, BridgeEventListener } from '../core/types';
import { NativeUIBridgeRegistry } from '../core/registry';
import type { NativeActionExecutor } from '../control/types';
import { type ServerAdapter } from '../server/http-server';
import type { RouteProvider, KeepAwakeProvider } from '../server/types';
import { type CloudRelayConfig } from '../transport/CloudRelayClient';
import { ModalDetector } from '../modal/modal-detector';
import { ToastCapture } from '../toast/toast-capture';
import { UndoTracker } from '../undo/undo-tracker';
/**
 * UI Bridge Native context value
 */
export interface UIBridgeNativeContextValue {
    /** Feature flags */
    features: NativeUIBridgeFeatures;
    /** Configuration */
    config: NativeUIBridgeConfig;
    /** Element registry */
    registry: NativeUIBridgeRegistry;
    /** Action executor */
    executor: NativeActionExecutor;
    /** Modal stack tracker (declarative pushModal/dismissModal) */
    modalDetector: ModalDetector;
    /** Toast/snackbar tracker (declarative recordToast/dismissToast) */
    toastCapture: ToastCapture;
    /** Undo/redo action-correlation tracker */
    undoTracker: UndoTracker;
    /** Get all registered elements */
    getElements: () => RegisteredNativeElement[];
    /** Get all registered components */
    getComponents: () => RegisteredNativeComponent[];
    /** Create a snapshot */
    createSnapshot: () => NativeBridgeSnapshot;
    /** Subscribe to events */
    on: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => () => void;
    /** Unsubscribe from events */
    off: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => void;
    /** Whether the provider is initialized */
    initialized: boolean;
    /** Server running status */
    serverRunning: boolean;
    /** Start the HTTP server */
    startServer: () => Promise<void>;
    /** Stop the HTTP server */
    stopServer: () => void;
    /** Get the current navigation route (if a RouteProvider is configured) */
    getCurrentRoute: () => string | null;
}
/**
 * UI Bridge Native provider props
 */
export interface UIBridgeNativeProviderProps {
    /** Child components */
    children: React.ReactNode;
    /** Feature flags */
    features?: NativeUIBridgeFeatures;
    /** Configuration */
    config?: NativeUIBridgeConfig;
    /** Event handler */
    onEvent?: BridgeEventListener;
    /**
     * A ServerAdapter instance for the HTTP server.
     * The app is responsible for creating this using its preferred native TCP/HTTP library.
     * @see ServerAdapter interface in server/http-server.ts
     */
    serverAdapter?: ServerAdapter;
    /**
     * Navigation provider for programmatic route navigation via UI Bridge.
     * Pass Expo Router's push/back functions to enable `control/page/navigate`.
     */
    navigationProvider?: {
        navigate: (url: string) => void;
        back?: () => void;
    };
    /**
     * Screenshot provider for native screen capture via UI Bridge.
     * Pass a function that captures the current screen as base64 PNG.
     */
    screenshotProvider?: {
        capture: () => Promise<{
            base64: string;
            width: number;
            height: number;
        }>;
    };
    /**
     * Keep-awake provider for native screen-wake control via UI Bridge.
     * Pass expo-keep-awake's activateKeepAwakeAsync/deactivateKeepAwake (wrapped
     * to the request/release shape) so an external runner never loses the device
     * to a screen lock. The SDK never imports expo-keep-awake directly.
     */
    keepAwakeProvider?: KeepAwakeProvider;
    /**
     * Route provider for exposing the current navigation route in snapshots.
     * Wire this to Expo Router's `usePathname()` / `useSegments()` via a module-level ref.
     */
    routeProvider?: RouteProvider;
    /**
     * Configuration for the cloud relay tunnel (enables remote device verification
     * when USB/LAN are not available).  Omit `uiBridgeServer` — the provider wires
     * that automatically after the server starts.
     */
    cloudRelayConfig?: Omit<CloudRelayConfig, 'uiBridgeServer'>;
    /**
     * Enable mDNS advertisement so that runners on the same LAN can discover this
     * device automatically (requires react-native-zeroconf).
     */
    enableMdnsAnnounce?: boolean;
    /**
     * Stable device identifier used for mDNS TXT records and cloud relay
     * registration.  Typically sourced from expo-device or a UUID stored in
     * AsyncStorage.
     */
    deviceId?: string;
}
/**
 * UI Bridge Native Provider
 *
 * Provides UI Bridge Native context to child components.
 *
 * @example
 * ```tsx
 * // app/_layout.tsx
 * import { UIBridgeNativeProvider } from 'ui-bridge-native';
 *
 * export default function RootLayout() {
 *   return (
 *     <UIBridgeNativeProvider
 *       features={{ server: __DEV__, debug: __DEV__ }}
 *       config={{ serverPort: 8087 }}
 *     >
 *       <Stack>{children}</Stack>
 *     </UIBridgeNativeProvider>
 *   );
 * }
 * ```
 */
export declare function UIBridgeNativeProvider({ children, features, config, onEvent, serverAdapter, navigationProvider, screenshotProvider, keepAwakeProvider, routeProvider, cloudRelayConfig, enableMdnsAnnounce, deviceId, }: UIBridgeNativeProviderProps): import("react/jsx-runtime").JSX.Element;
/**
 * useUIBridgeNative hook
 *
 * Access the UI Bridge Native context. Throws if used outside provider.
 */
export declare function useUIBridgeNative(): UIBridgeNativeContextValue;
/**
 * useUIBridgeNativeOptional hook
 *
 * Access the UI Bridge Native context, returning null if outside provider.
 */
export declare function useUIBridgeNativeOptional(): UIBridgeNativeContextValue | null;
/**
 * useUIBridgeNativeRequired hook
 *
 * Alias for useUIBridgeNative (throws if outside provider).
 */
export declare const useUIBridgeNativeRequired: typeof useUIBridgeNative;
//# sourceMappingURL=UIBridgeNativeProvider.d.ts.map