import axios from "../../../config/axios";

export const getUserSubscriptions = async (
  page: number,
  status?: string,
  serviceId?: string,
  q?: string,
) => {
  let query = `?page=${page}`;
  if (status) {
    query += `&status=${status}`;
  }
  if (serviceId) {
    query += `&serviceId=${serviceId}`;
  }
  if (q) {
    query += `&q=${q}`;
  }
  const { data } = await axios.get(
    `/subscriptions/admin/user-subscriptions/all${query}`,
  );
  return data;
};

export const deleteSubscription = async (id: string) => {
  const { data } = await axios.delete(`/subscriptions/${id}`);
  return data;
};
