import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/CriticismsService";

export const useGetCriticismsList = (page: number) => {
  return useQuery({
    queryKey: ["criticisms", page],
    queryFn: () => api.getCriticismsList(page),
  });
};

export const useDeleteCriticismsDetail = () => {
  return useMutation({
    mutationFn: (id: string) => api.deleteCriticisms(id),
  });
};

export const useGetDetailCriticisms = (id: string) => {
  return useQuery({
    queryKey: ["criticisms", id],
    queryFn: () => api.getCriticismsDetail(id),
    enabled: !!id,
  });
};
