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

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

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

export const useGetIconsQuery = (enabled: boolean) => {
  return useQuery<PostGetSeriesIcons, BaseAxiosError>({
    queryKey: seriesQueryKeys.getIcons(),
    queryFn: async () => {
      const response = await seriesApi.getIcons();
      return response.data;
    },
    enabled
  });
};
