import { useMutation } from '@tanstack/react-query';

import { notificationsQueryKeys } from '../notifications-query-keys';
import { type Settings, notificationsApi } from '../notifications-api';

import type { BaseAxiosError } from '../../../../types';
import { ResponseType } from '@api/response-type';

export const usePostSetSettingsMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, Settings, ResponseType>({
    mutationKey: notificationsQueryKeys.setSettings(),
    mutationFn: async (data) => {
      const response = await notificationsApi.setSettings(data);
      return response.data;
    }
  });
};
