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

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

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

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