
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import Actions from "../../Components/Ui/tables/Actions";
import ColumnsImage from "../../Components/Columns/ColumnsImage";
import { useNavigate } from "react-router-dom";
import { useDeleteSupportMessages } from "../../api/supportmessages";


const useTableColumns :any = () => {
  const [t] = useTranslation();
  const deleteMutation = useDeleteSupportMessages()
  const navigate = useNavigate()

  return useMemo(
    () => [
 
      {
        name: t("email"),
        center: true,
        selector: (row: any) => row.email, // Specify selector function for sorting
      },  

      {
        name: t("whatsApp"),
        center: true,
        selector: (row: any) => row.whatsApp, // Specify selector function for sorting
      }, 

      {
        name: t("subject"),
        center: true,
        selector: (row: any) => row.subject, // Specify selector function for sorting
      }, 
      {
        name: t("message"),
        center: true,
        selector: (row: any) => row.message, // Specify selector function for sorting
      }, 
      {
        name: "#",
        sortable: false,
        center: true,
        cell: (row:any) => (
          <Actions
            objectToEdit={row}
            
            onEdit={()=> navigate(`/support_messages/${row.id}`) }
            showView={false}
            showEdit={false}
            onDelete={() => deleteMutation.mutate({ id: row.id })}
          />
        ),
      },

    ],
    [t]
  );
};

export default useTableColumns;

