import { isEqual } from 'es-toolkit';
import { SortDirectionType } from './SortUtils';
import { TableColumnDetailsMap, TableColumnsSettings } from '../components/table/native/TableSettingsDialog';
export { isEqual };
export type ColumnsSettings = TableColumnsSettings;
export type TableColumnConfigItem = {
    key: string;
    visible?: boolean;
    width?: number | string;
};
/**
 * Returns a compact sort direction prefix for use in URL params.
 * Serialize: Ascending = "", Descending = "-"
 *
 * Useful for concise sort state like `sort=-name` or `sort=name`.
 *
 * @example
 * getSortDirShort(SortDirection.DESCENDING) // '-'
 */
export declare const getSortDirShort: (sortDir: string) => "" | "-";
/**
 * Returns a serialized string of the sort order and sort direction.
 *
 * @param sortInfo { sortDir: SortDirectionType; sortBy: string }
 * @returns
 */
export declare const serializeSorting: (sortInfo: {
    sortDir: SortDirectionType;
    sortBy: string;
}) => string | null;
/**
 * Parses a compact sort param (e.g. `name` or `-name`) into sort fields.
 * Useful when reading URL params into table state.
 *
 * @example
 * parseSorting('-createdAt') // { sortBy: 'createdAt', sortDir: 'desc' }
 */
export declare const parseSorting: (sortValueShort: string | null | undefined) => {
    sortBy: string;
    sortDir: "desc";
} | {
    sortBy: string;
    sortDir: "asc";
} | null;
/**
 * Serializes column settings into compact strings for a URL param.
 * Useful to keep table configuration URLs short and readable.
 *
 * Note: This utility function is intended for the TableSettingsDialog working with the
 * native table elements.
 *
 * @example
 * mapColumnsSettingsToStrings({ columnOrder: ['name'], hiddenColumns: [], columnsDetails: { name: { width: 120 } } })
 * // ['name:120']
 */
export declare const mapColumnsSettingsToStrings: ({ columnOrder, hiddenColumns, columnsDetails, }: ColumnsSettings) => string[];
/**
 * Parses compact column strings into column settings using defaults.
 * Useful to restore table settings from URL state.
 *
 * Note: This utility function is intended for the TableSettingsDialog working with the
 * native table elements.
 *
 * @example
 * parseColumnsSettingsStrings(['-name:200'], { name: { width: 120, defaultWidth: 120 } })
 */
export declare const parseColumnsSettingsStrings: (settings: string[], defaultColumnsDetails: TableColumnDetailsMap) => TableColumnsSettings;
/**
 * Serializes new table columns config into compact strings for a URL param.
 *
 * Format:
 * - visible column: `name`
 * - hidden column: `-name`
 * - width override: `name:200`
 *
 * @example
 * serializeColumnsConfig([{ key: 'name', visible: true, width: 120 }], [{ key: 'name', width: 100 }])
 * // ['name:120']
 */
export declare const serializeColumnsConfig: <TColumn extends TableColumnConfigItem>(columns: TColumn[], defaultColumns?: TColumn[]) => string[];
/**
 * Deserializes compact URL strings into new table columns config using defaults.
 *
 * @example
 * deserializeColumnsConfig(['-name:200'], [{ key: 'name', width: 120, visible: true }])
 */
export declare const deserializeColumnsConfig: <TColumn extends TableColumnConfigItem>(configStrings: string[], defaultColumns: TColumn[]) => TColumn[];
export type UrlTypeMap = {
    string: string;
    number: number;
    boolean: boolean;
    array: string[];
    'array-number': number[];
    object: Record<string, unknown>;
};
export type UrlValueType = keyof UrlTypeMap;
export type UrlConfigItem<TState = unknown, TValue = unknown> = {
    /**
     * The query param key in the URL (e.g., 'q', 'sort')
     */
    key: string;
    /**
     * Selector to retrieve the current value from Redux.
     */
    selector: (state: TState) => TValue;
    /**
     * Action creator to dispatch the new value to Redux.
     */
    action: (value: TValue) => unknown;
    /**
     * The generic type for auto-parsing/serialization
     */
    type?: UrlValueType;
    /**
     * Default value for the given key. Must be explicitly provided and
     * must not be `undefined`.
     *
     * 1. If URL is missing the key, this value is applied to Redux.
     * 2. If Redux matches this value, the key is removed from URL.
     */
    defaultValue: Exclude<TValue, undefined>;
    /**
     * Navigation behavior when this specific value changes
     *
     * Behavior in `useUrlState`:
     * - `'push'`: every change creates a new history entry.
     * - `'replace'`: changes replace the current entry, except the first
     *   transition from default -> non-default, which is pushed once.
     *
     * @default 'push'
     */
    history?: 'push' | 'replace';
    /**
     * Optional: Custom function to convert Redux Object -> URL String
     */
    customSerialize?: (reduxValue: TValue) => string | null;
    /**
     * Optional: Custom function to convert URL String -> Redux Object
     */
    customDeserialize?: (urlValue: string | null) => TValue | null;
};
/**
 * Generates a URL query string that mimics 'qs' library behavior
 * by keeping commas and plus signs unencoded for readability.
 */
export declare const toQueryString: (params: URLSearchParams, config: readonly UrlConfigItem[]) => string;
/**
 * Converts a JS value into a string suitable for URLSearchParams.
 * Returns null if the value is empty/invalid.
 */
export declare const serializeValue: <K extends UrlValueType>(value: UrlTypeMap[K] | null | undefined, type: K) => string | null;
/**
 * Generic deserialize function. Converts a URL string value back into a JS Primitive/Object.
 *
 * <TUrlValueType extends UrlValueType>: Capture the specific string literal passed in (e.g. 'number').
 * Returns: UrlTypeMap[TUrlValueType] | null (e.g. number | null).
 */
export declare const deserializeValue: <TUrlValueType extends UrlValueType>(value: string | null, type: TUrlValueType) => UrlTypeMap[TUrlValueType] | null;
