import { ReactNode } from 'react';
import { TableRow } from '../types';
import { Svg } from '../../../../types';
/**
 * Represents a sorted column configuration for DataTable
 */
export type SortedColumn = {
    /**
     * The column identifier
     */
    id: string;
    /**
     * Whether the column is sorted in descending order
     */
    desc: boolean;
};
/**
 * Configuration for the empty state displayed when the DataTable has no data
 */
export type DataTableEmptyState = {
    /**
     * Optional SVG illustration component to display.
     * Pass a single SVG component, or an object with `light` and `dark` properties
     * to display different illustrations based on the user's color scheme preference.
     */
    svg?: Svg | {
        light?: Svg;
        dark?: Svg;
    };
    /**
     * Optional content to display below the illustration
     */
    content?: ReactNode;
};
/**
 * Configuration for caching loadPageData results in DataTable.
 * When enabled, resolved page data is cached per page index, allowing
 * instant restoration when returning to a previously loaded page.
 * @property {boolean} [enabled] - Whether caching is enabled. Defaults to true.
 * @property {number} [maxSize] - Maximum number of pages to cache. Oldest entry is evicted (FIFO) when the limit is reached. Defaults to 15.
 */
export type DataTableCacheOptions = {
    /**
     * Whether caching is enabled.
     * @default true
     */
    enabled?: boolean;
    /**
     * Maximum number of pages to cache. When the limit is reached, the oldest cached page is
     * evicted (FIFO) to make room for the new entry.
     * @default 15
     */
    maxSize?: number;
};
/**
 * Pagination behavior for DataTable.
 * "offset" uses numbered pages with a known total row count.
 * "cursor" uses previous/next availability for unknown-total pagination.
 */
export type DataTablePaginationMode = "offset" | "cursor";
type DataTablePaginationBaseConfig<T> = {
    /**
     * Number of rows displayed per page
     * @default 25
     */
    rowsPerPage?: number;
    /**
     * Available options for rows per page selection
     * @default [25, 50, 100]
     */
    rowsPerPageOptions?: number[];
    /**
     * Callback when rows per page changes
     */
    onRowsPerPageChange?: (rowsPerPage: number) => void;
    /**
     * Current page index (0-based)
     */
    currentPageIndex?: number;
    /**
     * Function to get the data for the current page. When used, the data displayed will be
     * fully controlled by the implementor. This is useful for server-side pagination scenarios where
     * the total number of rows may differ from the data array length.
     *
     * The `sorting` parameter is provided when a column is sorted, allowing the server
     * to return data in the correct sort order.
     */
    loadPageData?: ({ pageIndex, pageSize, sorting, }: {
        pageIndex: number;
        pageSize: number;
        sorting?: SortedColumn;
    }) => TableRow<T>[] | Promise<TableRow<T>[]>;
    /**
     * Default page index for uncontrolled mode (0-based)
     * @default 0
     */
    defaultPageIndex?: number;
    /**
     * Callback when page changes. Receives the new page index (0-based)
     */
    onPageChange?: (pageIndex: number) => void;
    /**
     * Key that triggers data refetch when changed.
     * Useful for forcing refetch when external filters change.
     * When changed, the page index automatically resets to 0.
     */
    refreshKey?: string | number;
    /**
     * Configuration for caching loadPageData results.
     * Caching is enabled by default. Set `{ enabled: false }` to disable.
     */
    cache?: DataTableCacheOptions;
};
export type DataTableOffsetPaginationConfig<T> = DataTablePaginationBaseConfig<T> & {
    /**
     * Offset pagination mode.
     * @default "offset"
     */
    mode?: "offset";
    /**
     * Whether to display the item count information in pagination
     * @default true
     */
    showCount?: boolean;
    /**
     * Total number of rows across all pages in offset mode. Falls back to data.length if not provided.
     * Useful for server-side pagination scenarios where totalRowCount may differ from data array length.
     */
    totalRowCount?: number;
    hasNextPage?: never;
    hasPrevPage?: never;
};
export type DataTableCursorPaginationConfig<T> = DataTablePaginationBaseConfig<T> & {
    /**
     * Cursor pagination mode for datasets where the total row count is unknown.
     */
    mode: "cursor";
    /**
     * Whether another page is available.
     */
    hasNextPage: boolean;
    /**
     * Whether a previous page is available.
     */
    hasPrevPage: boolean;
    showCount?: never;
    totalRowCount?: never;
};
/**
 * Configuration for pagination in DataTable
 */
export type DataTablePaginationConfig<T> = DataTableOffsetPaginationConfig<T> | DataTableCursorPaginationConfig<T>;
/**
 * Ref handle for DataTable component
 * @property {function} refresh - Triggers a data refetch and resets the page index to 0. Useful for manually refreshing data after external changes (e.g., after a mutation).
 * @property {function} clearCache - Clears the page data cache without triggering a refetch.
 */
export type DataTableRef = {
    /**
     * Triggers a data refetch and resets the page index to 0.
     * Useful for manually refreshing data after external changes (e.g., after a mutation).
     * When using controlled pagination, this will call `onPageChange(0)`.
     */
    refresh: () => void;
    /**
     * Clears the page data cache without triggering a refetch.
     */
    clearCache: () => void;
};
export {};
