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

import { countriesQueryKeys } from '../countries-query-keys';
import { type PostSetSlow, countriesApi } from '../countries-api';

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

export const usePostSetSlowMutation = () => {
  return useMutation<ResponseType, BaseAxiosError, PostSetSlow, ResponseType>({
    mutationKey: countriesQueryKeys.setSlow(),
    mutationFn: async (data) => {
      const response = await countriesApi.setSlow(data);
      return response.data;
    }
  });
};
