// [nexus] React Query hook for hardware detection data
import { useQuery } from "@tanstack/react-query";
import { fetchHardwareInfo, type HardwareInfo } from "../api/hardware";
import { queryKeys } from "../lib/queryKeys";

export function useHardwareInfo(enabled = true) {
  return useQuery<HardwareInfo>({
    queryKey: queryKeys.hardware.info,
    queryFn: fetchHardwareInfo,
    enabled,
    staleTime: 5 * 60 * 1000, // 5 minutes — matches server cache TTL
    retry: 1,
  });
}
