/**
 * Generic polling hook for async operations.
 *
 * Provides a reusable polling mechanism with configurable intervals,
 * max attempts, and completion detection. Used by usePaymentVerification
 * and other hooks that need to poll for status changes.
 *
 * @example
 * ```tsx
 * const polling = usePolling(shouldPoll ? {
 *   pollFn: () => api.getStatus(id),
 *   isComplete: (result) => result.status === 'done',
 * } : null);
 *
 * useEffect(() => {
 *   if (polling.status === 'completed') {
 *     handleSuccess(polling.result);
 *   }
 * }, [polling.status]);
 * ```
 */
export type UsePollingConfig<T> = {
    /** Function to call on each poll - should return the data to check */
    pollFn: () => Promise<T>;
    /** Returns true when polling should stop (success condition) */
    isComplete: (result: T) => boolean;
    /** Optional: returns true if result indicates failure (stops polling) */
    isFailed?: (result: T) => boolean;
    /** Max attempts before timeout (default: 10) */
    maxAttempts?: number;
    /** Interval between polls in ms (default: 1000) */
    interval?: number;
};
export type UsePollingResult<T> = {
    /** Current polling status */
    status: 'idle' | 'polling' | 'completed' | 'failed' | 'timeout';
    /** Result from the last successful poll (null while polling or on error) */
    result: T | null;
    /** Error if polling failed */
    error: Error | null;
    /** Manually trigger a retry (restarts polling) */
    retry: () => void;
};
/**
 * Generic hook for polling an async operation until completion.
 *
 * Pass config to start polling, or null to stop/idle.
 * The hook handles cleanup on unmount and config changes.
 *
 * **IMPORTANT: Config identity stability**
 *
 * The config object is used as an effect dependency. If config identity
 * changes on every render (e.g., inline objects), polling will restart
 * continuously, causing infinite request loops.
 *
 * Always memoize the config object:
 *
 * @example
 * ```tsx
 * // BAD - inline object creates new identity every render
 * usePolling({
 *   pollFn: () => api.getStatus(id),
 *   isComplete: (result) => result.status === 'done',
 * });
 *
 * // GOOD - memoized config, stable identity
 * const pollConfig = useMemo(() => shouldPoll ? {
 *   pollFn: () => api.getStatus(id),
 *   isComplete: (result) => result.status === 'done',
 * } : null, [shouldPoll, api, id]);
 *
 * usePolling(pollConfig);
 * ```
 *
 * @param config - Configuration for polling, or null to stop
 * @returns Polling result with status, data, and retry function
 */
export declare function usePolling<T>(config: UsePollingConfig<T> | null): UsePollingResult<T>;
