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

import { appQueryKeys } from '../app-query-keys';
import { appApi } from '../app-api';
import { ResponseType } from '../../response-type';

import type { BaseAxiosError } from '../../../../types';

export const useDeleteUserMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, { token: string }, ResponseType>({
    mutationKey: appQueryKeys.deleteUser(),
    mutationFn: async (variables) => {
      const response = await appApi.deleteUser(variables.token);
      return response.data;
    }
  });
};
