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

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

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

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