import { SpanTab, TraceDatePreset } from '../index';
import { EntityOptions, TraceListMode, TraceStatusFilter } from '../trace-filters';
import { PropertyFilterToken } from '../../../ds/components/PropertyFilter/types';
/** Minimal interface compatible with react-router's `setSearchParams`. */
export type SetURLSearchParamsLike = (next: URLSearchParams | ((prev: URLSearchParams) => URLSearchParams), options?: {
    replace?: boolean;
    preventScrollReset?: boolean;
    state?: unknown;
}) => void;
export interface UseTraceUrlStateOptions {
    /** Called after `handleRemoveAll` clears all filter URL params. Use this to reset page-local
     *  UI state (e.g. a "group by thread" toggle) without wrapping the handler. */
    onRemoveAll?: () => void;
}
export interface UseTraceUrlStateResult {
    searchParams: URLSearchParams;
    setSearchParams: SetURLSearchParamsLike;
    datePreset: TraceDatePreset;
    selectedDateFrom: Date | undefined;
    selectedDateTo: Date | undefined;
    /** Synchronously-updated ref of the latest preset. Used to ignore onDateChange callbacks
     *  the date picker fires after a non-custom preset switch. */
    datePresetRef: React.MutableRefObject<TraceDatePreset>;
    traceIdParam: string | undefined;
    spanIdParam: string | undefined;
    /** Branch-mode only: the anchor span that defines the displayed subtree. Stable while the
     *  user navigates between spans inside the panel (which only changes `spanIdParam`). */
    anchorSpanIdParam: string | undefined;
    spanTabParam: SpanTab | undefined;
    scoreIdParam: string | undefined;
    listMode: TraceListMode;
    selectedEntityOption: EntityOptions | undefined;
    selectedStatus: TraceStatusFilter | undefined;
    filterTokens: PropertyFilterToken[];
    /**
     * Selects a row. In traces mode pass just `traceId` (and optionally a `spanId` for an
     * initial span selection in the panel). In branches mode also pass `anchorSpanId` — the
     * branch identity, kept stable while the user navigates between spans inside the panel.
     * Branch rows are identified by (traceId, anchorSpanId); trace rows by traceId alone.
     */
    handleTraceClick: (traceId: string, spanId?: string, anchorSpanId?: string) => void;
    /** Convenience: clears the featured trace selection. Equivalent to `handleTraceClick('')`. */
    handleTraceClose: () => void;
    handleSpanChange: (spanId: string | null) => void;
    /** Convenience: clears the featured span selection. Equivalent to `handleSpanChange(null)`. */
    handleSpanClose: () => void;
    handleSpanTabChange: (tab: SpanTab) => void;
    handleScoreChange: (scoreId: string | null) => void;
    /** Switches the list view between traces and branches. Clears the current selection. */
    handleListModeChange: (mode: TraceListMode) => void;
    handleFilterTokensChange: (nextTokens: PropertyFilterToken[]) => void;
    handleDateChange: (value: Date | undefined, type: 'from' | 'to') => void;
    handleDatePresetChange: (preset: TraceDatePreset) => void;
    handleRemoveAll: () => void;
    /** Lower-level helper used by `handleClear`: writes a token set and clears the trace/span selection. */
    applyFilterTokens: (tokens: PropertyFilterToken[]) => void;
}
/**
 * Owns all URL-derived state and URL-modifying handlers for the traces page. Routing-agnostic —
 * pass `searchParams` and `setSearchParams` from whichever router the consumer uses.
 *
 * Stays focused on URL state: localStorage save/restore, filter discovery, and the error-view
 * short-circuit are intentionally NOT part of this hook so consumers can swap them independently.
 */
export declare function useTraceUrlState(searchParams: URLSearchParams, setSearchParams: SetURLSearchParamsLike, options?: UseTraceUrlStateOptions): UseTraceUrlStateResult;
