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 usePostGetCountriesRankingMemoriam = () => {
  return useQuery<PostGetCountriesRanking, BaseAxiosError>({
    queryKey: rankingQueryKeys.getCountriesRankingMemoriam(),
    queryFn: async () => {
      const response = await rankingApi.getCountriesRankingMemoriam();
      return response.data;
    }
  });
};
