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

import { seriesQueryKeys } from '../series-query-keys';
import { seriesApi, type PostGetSuggestionData } from '../series-api';

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

export const useGetSuggestionData = () => {
  return useQuery<PostGetSuggestionData, BaseAxiosError>({
    queryKey: seriesQueryKeys.getSuggestionData(),
    queryFn: async () => {
      const response = await seriesApi.getSuggestionData();
      return response.data;
    }
  });
};
