
import  { useMemo } from "react";
import { useTranslation } from "react-i18next";


const useTableColumns :any = () => {
  const [t] = useTranslation();
  const language = localStorage.getItem("language") ?? "en"

  return useMemo(
    () => [
      {
        name: t("id"),
        sortable: true, // Enable sorting for id column
        center: true,
        selector: (row: any) => row.id, // Specify selector function for sorting
      },      {
        name: t("name"),
        sortable: false,
        center: true,
        selector:(row:any) => row?.name?.[language],

      },
      {
        name: t("quantity"),
        sortable: false,
        center: true,
        selector:(row:any) => row?.quantity,

      },
      
      {
        name: t("category"),
        sortable: false,
        center: true,
        cell: (row:any) => (
          row?.category?.name?.[language]
        ),
      },
     

     
    ],
    [language, t]
  );
};

export default useTableColumns;

