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

import { rankingQueryKeys } from '../ranking-query-keys';
import { type PostGetCountriesRanking, rankingApi } from '../ranking-api';

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

export const usePostGetCountriesRankingLPI = () => {
  return useQuery<PostGetCountriesRanking, BaseAxiosError>({
    queryKey: rankingQueryKeys.getCountriesRankingLPI(),
    queryFn: async () => {
      const response = await rankingApi.getCountriesRankingLPI();
      return response.data;
    }
  });
};
