import {
  createOnlineCase,
  getAllOnlineCases,
  getSingleOnlineCase,
  updateOnlineCase,
} from "@/service/apis/online-case";
import {useMutation, useQuery} from "@tanstack/react-query";

export const useGetAllOnlineCases = () =>
  useQuery({
    queryKey: ["get-all-online-cases"],
    queryFn: getAllOnlineCases,
    retry: false,
    refetchOnWindowFocus: false,
  });

export const useCreateOnlineCase = () =>
  useMutation({mutationFn: createOnlineCase});
export const useUpdateOnlineCase = () =>
  useMutation({mutationFn: updateOnlineCase});

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