import axios from "@/config/axios";
import {
  CategoryResponse,
  DanakServiceSuggestedResponse,
  ServiceResponse,
} from "../types/ProductTypes";

export const getServicesByCategory = async (categoryId?: string) => {
  let query = ``;
  if (categoryId) {
    query = `?categoryId=${categoryId}`;
  }
  const { data } = await axios.get<ServiceResponse>(
    `/danak-services/public${query}`
  );
  return data;
};

export const getCategoriesPublic = async () => {
  const { data } = await axios.get<CategoryResponse>(
    `/danak-services/categories/public`
  );
  return data;
};

export const getDanakServiceSuggested = async () => {
  const { data } = await axios.get<DanakServiceSuggestedResponse>(
    `/danak-services/suggested`
  );
  return data;
};
