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

import { chatQueryKeys } from '../chat-query-keys';
import { chatApi, type PostUnreactToMessage } from '../chat-api';

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

export const usePostUnreactToMessageMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, PostUnreactToMessage, ResponseType>({
    mutationKey: chatQueryKeys.unreactToMessage(),
    mutationFn: async (data) => {
      const response = await chatApi.unreactToMessage(data);
      return response.data;
    }
  });
};
