"use client";

import React, { memo } from "react";
import { DataTable } from "@/components/ui/data-table"; // Updated import

interface ProductsTableProps {
  columns: any[];
  data: any[];
  onRowClick: (row: any) => void;
  emptyState?: React.ReactNode;
}

/**
 * ⚡ Optimization: Memoized ProductsTable
 * Prevents redundant re-renders of the table wrapper. When combined with
 * stable props from OverviewClient, this ensures the product grid only
 * re-renders when necessary.
 */
export const ProductsTable = memo(({ columns, data, onRowClick, emptyState }: ProductsTableProps) => {
  return (
    <DataTable
      columns={columns}
      data={data}
      onRowClick={onRowClick}
      emptyState={emptyState}
    />
  );
});

ProductsTable.displayName = "ProductsTable";
