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

import { photosQueryKeys } from '../photos-query-keys';
import { type PostSetSaveTempReturn, type PostSetSaveTemp, photosApi } from '../photos-api';

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

export const usePostSaveTempMutation = () => {
  return useMutation<
    PostSetSaveTempReturn,
    BaseAxiosError,
    PostSetSaveTemp,
    PostSetSaveTempReturn
  >({
    mutationKey: photosQueryKeys.saveTemp(),
    mutationFn: async (data) => {
      const response = await photosApi.saveTemp(data);
      return response.data;
    }
  });
};
