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

import { photosQueryKeys } from '../photos-query-keys';
import { photosApi } from '../photos-api';
import { ResponseType } from '../../response-type';

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

export const usePostRemoveTempMutation = () => {
  return useMutation<
    ResponseType,
    BaseAxiosError,
    { token: string; guid: string },
    ResponseType
  >({
    mutationKey: photosQueryKeys.removeTemp(),
    mutationFn: async (variables) => {
      const response = await photosApi.removeTemp(variables.token, variables.guid);
      return response.data;
    }
  });
};
