import { useQuery } from "@tanstack/react-query";
import * as api from "../service/AboutService";
import { useParams } from "next/navigation";

export const useGetAbout = () => {
  const { name } = useParams<{ name: string }>();
  return useQuery({
    queryKey: ["about"],
    queryFn: () => api.getAbout(name),
    enabled: !!name,
    retry: false,
  });
};

export const useGetReviews = () => {
  const { name } = useParams<{ name: string }>();
  return useQuery({
    queryKey: ["reviews"],
    queryFn: () => api.getReviews(name),
    enabled: !!name,
    retry: false,
  });
};

export const useGetSchedules = () => {
  const { name } = useParams<{ name: string }>();
  return useQuery({
    queryKey: ["schedules"],
    queryFn: () => api.getSchedules(name),
    enabled: !!name,
    retry: false,
  });
};
