import {
  createExpertise,
  deleteExpertise,
  getAllExpertise,
  getExpertiseList,
  getSingleExpertise,
  updateExpertise,
} from "@/service/apis/expertise";
import {useMutation, useQuery} from "@tanstack/react-query";

export const useCreateExpertise = () =>
  useMutation({mutationFn: createExpertise});

export const useUpdateExpertise = () =>
  useMutation({mutationFn: updateExpertise});

export const useDeleteExpertise = () =>
  useMutation({mutationFn: deleteExpertise});

export const useGetAllExpertise = (lang: string) =>
  useQuery({
    queryKey: ["get-all-expertise", lang],
    queryFn: () => getAllExpertise(lang),
    retry: false,
    refetchOnWindowFocus: false,
  });

export const useGetSingleExpertise = (id: string) =>
  useQuery({
    queryKey: ["get-single-expertise", id],
    queryFn: () => getSingleExpertise(id),
    retry: false,
    refetchOnWindowFocus: false,
  });

export const useGetAllExpertiseList = () => useQuery({
  queryKey:['get-list-expertise'],
  queryFn:getExpertiseList,
  retry:false,
  refetchOnWindowFocus:false
})