import SortableTable, { SortableTableProps } from './Table';

interface PaginatedTableProps<TData>
  extends Omit<SortableTableProps<TData>, 'data'> {
  prismaGetter: (
    fnProps: {
      cursor: number;
      take: number;
    } & any
  ) => Promise<any>;
}

export async function PaginatedTable<TData>({
  prismaGetter,
  ...restProps
}: PaginatedTableProps<TData>) {
  const data = await prismaGetter({
    cursor: 0,
    take: 10,
  });

  return (
    <div>
      <SortableTable data={data} {...restProps} />
    </div>
  );
}
