import apiClient from './authApi';

export interface NotificationPreferences {
  emailNotificationsEnabled: boolean;
  pushNotificationsEnabled: boolean;
  inAppNotificationsEnabled: boolean;
}

export interface UpdateNotificationPreferences {
  emailNotificationsEnabled?: boolean;
  pushNotificationsEnabled?: boolean;
  inAppNotificationsEnabled?: boolean;
}

/**
 * Get current user's notification preferences
 */
export const getNotificationPreferences = async (): Promise<NotificationPreferences> => {
  const response = await apiClient.get<{ success: boolean; data: NotificationPreferences }>(
    '/user/preferences/notifications'
  );
  return response.data.data;
};

/**
 * Update current user's notification preferences
 */
export const updateNotificationPreferences = async (
  preferences: UpdateNotificationPreferences
): Promise<NotificationPreferences> => {
  const response = await apiClient.put<{ success: boolean; data: NotificationPreferences }>(
    '/user/preferences/notifications',
    preferences
  );
  return response.data.data;
};

