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

import { regionsQueryKeys } from '../regions-query-keys';
import { type PostDeleteVisit, regionsApi } from '../regions-api';

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

export const usePostDeleteVisitMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, PostDeleteVisit, ResponseType>({
    mutationKey: regionsQueryKeys.deleteVisit(),
    mutationFn: async (data) => {
      const response = await regionsApi.deleteVisit(data);
      return response.data;
    }
  });
};
