import { type UseQueryOptions } from '@tanstack/react-query';
import { type ColumnDef, type ColumnFiltersState, type ColumnPinningState, type ExpandedState, type PaginationState, type RowSelectionState, type SortingState, type Table, type VisibilityState } from '@tanstack/react-table';
export interface FetcherParams {
    pageNo: number;
    pageSize: number;
    sortBy: SortingState;
    reversed: boolean;
    columnFilters: ColumnFiltersState;
    search: string;
}
export interface FetcherResponse<TData> {
    data: TData[];
    totalCount?: number;
}
export interface UseDataTableOptions<TData> {
    /**
     * Unique key for the query cache
     * @required
     */
    queryKey: string;
    /**
     * Column definitions for the table
     */
    columns: ColumnDef<TData>[];
    /**
     * Fetcher function to load data
     * Receives fetch params and should return data + optional totalCount
     */
    fetcher: (params: FetcherParams) => Promise<FetcherResponse<TData>>;
    /**
     * Initial page size
     * @default 10
     */
    initialPageSize?: number;
    /**
     * Initial sorting state
     */
    initialSorting?: SortingState;
    /**
     * Initial column visibility
     */
    initialColumnVisibility?: VisibilityState;
    /**
     * Initial column pinning state
     * @example { left: ['select'], right: ['actions'] }
     */
    initialColumnPinning?: ColumnPinningState;
    /**
     * Whether pagination is handled manually (server-side)
     * @default false
     */
    manualPagination?: boolean;
    /**
     * Whether sorting is handled manually (server-side)
     * @default false
     */
    manualSorting?: boolean;
    /**
     * Whether filtering is handled manually (server-side)
     * @default false
     */
    manualFiltering?: boolean;
    /**
     * Function to get sub-rows from a row (for expandable rows)
     * @example (row) => row.subRows
     */
    getSubRows?: (row: TData) => TData[] | undefined;
    /**
     * Function to determine if a row can be expanded.
     * Set to `() => true` to allow all rows to expand (useful for lazy-loaded sub-components).
     * @example () => true
     * @example (row) => row.original.hasDetails
     */
    getRowCanExpand?: (row: {
        original: TData;
    }) => boolean;
    /**
     * Additional react-query options
     * Allows customizing staleTime, gcTime, refetchInterval, etc.
     */
    queryOptions?: Omit<UseQueryOptions<FetcherResponse<TData>, Error>, 'queryKey' | 'queryFn'>;
    /**
     * Additional metadata to pass to the table instance (accessible via table.options.meta)
     */
    meta?: Record<string, unknown>;
}
export interface UseDataTableReturn<TData> {
    /**
     * The table instance from @tanstack/react-table
     */
    table: Table<TData>;
    /**
     * The current data array
     */
    data: TData[];
    /**
     * Whether the initial data is loading (no data yet)
     */
    isLoading: boolean;
    /**
     * Whether data is being fetched (including background refetches)
     */
    isFetching: boolean;
    /**
     * Whether a refetch is in progress
     */
    isRefetching: boolean;
    /**
     * Error if the fetch failed
     */
    error: Error | null;
    /**
     * Total count of items (for pagination)
     */
    totalCount: number;
    /**
     * Refetch the data
     */
    refetch: () => void;
    /**
     * Current search (global filter) value
     */
    search: string;
    /**
     * Set the search (global filter)
     */
    setSearch: (value: string) => void;
    /**
     * Current sorting state
     */
    sortBy: SortingState;
    /**
     * Current pagination state
     */
    pagination: PaginationState;
    /**
     * Current column filters
     */
    columnFilters: ColumnFiltersState;
    /**
     * Current column visibility
     */
    columnVisibility: VisibilityState;
    /**
     * Current row selection
     */
    rowSelection: RowSelectionState;
    /**
     * Current column pinning state
     */
    columnPinning: ColumnPinningState;
    /**
     * Current expanded state
     */
    expanded: ExpandedState;
    /**
     * Whether the query is in success state
     */
    isSuccess: boolean;
    /**
     * Whether the query is in error state
     */
    isError: boolean;
}
export declare function useDataTable<TData>({ queryKey, columns, fetcher, initialPageSize, initialSorting, initialColumnVisibility, initialColumnPinning, manualPagination, manualSorting, manualFiltering, getSubRows, getRowCanExpand, queryOptions, meta, }: UseDataTableOptions<TData>): UseDataTableReturn<TData>;
