'use client';

import type { ReactNode } from 'react';
import type { ColumnDef } from '@tanstack/react-table';

import { DataTable } from '@/components/data-table';
import type { Client } from '@/types';

interface ClientTableProps {
  columns: ColumnDef<Client>[];
  clients: Client[];
  isLoading: boolean;
  toolbar: ReactNode;
  skip: number;
  limit: number;
  total: number;
  onPageChange: (skip: number) => void;
  onLimitChange: (limit: number) => void;
}

export function ClientTable({
  columns,
  clients,
  isLoading,
  toolbar,
  skip,
  limit,
  total,
  onPageChange,
  onLimitChange,
}: ClientTableProps) {
  return (
    <DataTable
      title="Clients"
      columns={columns}
      data={clients}
      isLoading={isLoading}
      toolbar={toolbar}
      emptyTitle="No clients found."
      pagination={{
        skip,
        limit,
        totalItems: total,
        onPageChange,
        onLimitChange,
      }}
    />
  );
}
