import { useQuery } from "@tanstack/react-query";
import { getCompletionSchema } from "@/lib/tauri";

export function useCompletionSchema(connectionId?: string | null) {
  return useQuery({
    queryKey: ["completionSchema", connectionId],
    queryFn: () => getCompletionSchema(connectionId!),
    enabled: !!connectionId,
    staleTime: 5 * 60 * 1000,
  });
}
