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

export const useGetCompare = (productIds: string[]) => {
  return useQuery({
    queryKey: ["compare", productIds],
    queryFn: () => api.getCompare(productIds),
    enabled: !!productIds,
  });
};

export const useSearchCompareProduct = (productId?: string) => {
  return useQuery({
    queryKey: ["compare", productId],
    queryFn: () => api.searchComparProduct(productId),
    enabled: !!productId,
  });
};
