import axios from "@/config/axios";
import type { GetNotificationsResponse } from "../types/Types";

export const getNotifications = async (
  params?: Record<string, string | number>
): Promise<GetNotificationsResponse> => {
  const { data } = await axios.get<GetNotificationsResponse>(
    "/admin/notification-preferences",
    { params }
  );
  return data;
};

export const updateNotification = async (
  id: string,
  channels: ("sms" | "push" | "in-app")[]
) => {
  const { data } = await axios.patch(`/admin/notification-preferences/${id}`, {
    channels,
  });
  return data;
};
