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

import { mapsQueryKeys } from '../maps-query-keys';
import { mapsApi, type PostGetVisitedIds } from '../maps-api';

import type { BaseAxiosError } from '../../../../types';

export const usePostGetVisitedDareIdsQuery = (token: string, uid: number, enabled: boolean) => {
  return useQuery<PostGetVisitedIds, BaseAxiosError>({
    queryKey: mapsQueryKeys.getVisitedDareIds(token, uid),
    queryFn: async () => {
      const response = await mapsApi.getVisitedDareIds(token, uid);
      return response.data;
    },
    enabled
  });
};
