import { mutationOptions } from '@tanstack/react-query';
import { getQueryClient } from '@/lib/query-client';
import { markAllNotificationsAsRead, markNotificationAsRead } from './service';
import { notificationKeys } from './queries';

export const markNotificationAsReadMutation = mutationOptions({
  mutationFn: (id: number) => markNotificationAsRead(id),
  onSuccess: () => {
    getQueryClient().invalidateQueries({ queryKey: notificationKeys.all });
  }
});

export const markAllNotificationsAsReadMutation = mutationOptions({
  mutationFn: () => markAllNotificationsAsRead(),
  onSuccess: () => {
    getQueryClient().invalidateQueries({ queryKey: notificationKeys.all });
  }
});
