import { API_ENDPOINTS } from "@/lib/api";
import { flagsService } from "@/lib/api/services/flags-service";
import { useQuery } from "@tanstack/react-query";
import { useMemo } from "react";

export const useGetFlagQuery = (countryCode: string) => {
  const queryKey = useMemo(
    () => [API_ENDPOINTS.FLAGS(countryCode)],
    [countryCode],
  );

  return useQuery({
    queryKey,
    queryFn: () => flagsService.getCountryFlag(countryCode),
  });
};
