import axios from "../../../config/axios";
import { BuyServiceType } from "../types/ServiecTypes";

export const getServiceSuggestedDanak = async () => {
  const { data } = await axios.get(`/danak-services/suggested`);
  return data;
};
export const getCategoriesPublic = async () => {
  const { data } = await axios.get(`/danak-services/categories/public`);
  return data;
};
export const getServicesByCategory = async (categoryId: string) => {
  const { data } = await axios.get(
    `/danak-services/categories/${categoryId}/services`
  );
  return data;
};

export const getDetailService = async (serviceId: string) => {
  const { data } = await axios.get(`/danak-services/${serviceId}`);
  return data;
};

export const buyService = async (params: BuyServiceType) => {
  const { data } = await axios.post(
    `/subscriptions/${params.serviceId}/subscribe`,
    params
  );
  return data;
};
export const getMyServices = async (search: string) => {
  const { data } = await axios.get(`/subscriptions/user?q=${search}`);
  return data;
};
