import { api } from "@/config/axios";
import { RESTAURANT_FETCH_TIMEOUT_MS } from "@/app/[name]/lib/getRestaurant";
import {
  AboutResponse,
  ReviewsResponse,
  SchedulesResponse,
} from "../types/Types";

export const getAbout = async (name: string): Promise<AboutResponse> => {
  const { data } = await api.get<AboutResponse>(`/public/restaurants/${name}`, {
    timeout: RESTAURANT_FETCH_TIMEOUT_MS,
  });
  return data;
};

export const getReviews = async (name: string): Promise<ReviewsResponse> => {
  const { data } = await api.get<ReviewsResponse>(
    `/public/reviews/restuarant/${name}`
  );
  return data;
};

export const getSchedules = async (
  name: string
): Promise<SchedulesResponse> => {
  const { data } = await api.get<SchedulesResponse>(
    `/public/schedules/restaurant/${name}`
  );
  return data;
};
