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

export const useGetAnnoncement = (search: string) => {
  return useQuery({
    queryKey: ["announcements", search],
    queryFn: () => api.getAnnoncements(search),
  });
};

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