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

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

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

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