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

import { eventsQueryKeys } from '../events-query-keys';
import { type PostEventAddFile, eventsApi } from '../events-api';

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

export const usePostEventAddFileMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, PostEventAddFile, ResponseType>({
    mutationKey: eventsQueryKeys.eventAddFile(),
    mutationFn: async (data) => {
      const response = await eventsApi.eventAddFile(data);
      return response.data;
    }
  });
};
