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

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

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

export const usePostSetFullMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, { token: string; id: number; full: 0 | 1 }>({
    mutationKey: eventsQueryKeys.setFull(),
    mutationFn: async (data) => {
      const response = await eventsApi.setFull(data.token, data.id, data.full);
      return response.data;
    }
  });
};
