import axios from "@/config/axios";
import type { GetReviewsResponse, GetReviewByIdResponse } from "../types/Types";

export const getReviews = async (
  params?: Record<string, string | number>
): Promise<GetReviewsResponse> => {
  const { data } = await axios.get<GetReviewsResponse>("/admin/reviews", {
    params,
  });
  return data;
};

export const getReviewById = async (
  id: string
): Promise<GetReviewByIdResponse> => {
  const { data } = await axios.get<GetReviewByIdResponse>(
    `/admin/reviews/${id}`
  );
  return data;
};

export const updateReviewStatus = async (id: string, status: string) => {
  const { data } = await axios.patch(`/admin/reviews/${id}/status`, { status });
  return data;
};
