
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import Actions from "../../Components/Ui/tables/Actions";
import ColumnsImage from "../../Components/Columns/ColumnsImage";
import { ToggleStatus } from "../../Components/Ui/ToggleStatus";
import { useDeleteSocialMedia, useUpdateSocialMedia } from "../../api/SocialMedia";

function fnDelete(props :any ){}

const useTableColumns :any = () => {
  const [t] = useTranslation();
  const toggleMutation = useUpdateSocialMedia();
  const deleteMutation = useDeleteSocialMedia();

  return useMemo(
    () => [
 
      {
        name: t("link"),
        sortable: false,
        center: "true",
        cell: (row:any) => row?.link
      },
      {
        name: t("image"),
        center: "true",
        cell: (row: any) => {
          return (
            <ColumnsImage src={row?.image} />
          )
        }
      },
      // {
      //   name: t("status"),
      //   sortable: false,
      //   center: true,
      //   cell: (row:any) => (
      //     <ToggleStatus object={row} toggleMutation={toggleMutation} />
      //   ),
      // },
      {
        name: "#",
        sortable: false,
        center: "true",
        cell: (row:any) => (
            <Actions

            // importnat to return the row in on Edit Function to store in objectToEdit That Upper in Edit Modal 
              onEdit={() => row}
              onView={()=>{}}
              objectToEdit={row}
              showEdit={true}
              showView={false}
              onDelete={() => deleteMutation.mutate({ id: row.id })}
              />
        ),
      },
    ],
    [t]
  );
};

export default useTableColumns;

