import type { Table as TanstackTable, TableOptions, ColumnDef } from "@tanstack/react-table";

export interface DataTablePagination {
  pageSize?: number;
  pageIndex?: number;
  pageCount?: number;
  totalCount?: number;
}

export interface DataTableFooterProps<TData> {
  table: TanstackTable<TData>;
  pagination: DataTablePagination;
}

export type DataTableFooterComponent<TData> = (
  props: DataTableFooterProps<TData>
) => React.ReactNode;

export interface DataTableProps<TData, TValue> {
  columns: ColumnDef<TData, TValue>[];
  data: TData[];
  status?: "loading" | "error" | "success";
  onRowClick?: (row: TData) => void;
  tableOptions?: Omit<
    TableOptions<TData>,
    "data" | "columns" | "getCoreRowModel"
  >;
  pagination?: DataTablePagination;
  footer?: DataTableFooterComponent<TData>;
  footerClassName?: string;
  containerClassName?: string;
  emptyMessage?: string;
  error?: {
    message: string;
    description?: string;
    onRetry?: () => void;
  };
}
