import { useQuery } from "@tanstack/react-query"
import { supabase } from "@/lib/supabase"

export function useVocab(topic?: string) {
  return useQuery({
    queryKey: ["vocab", topic],
    queryFn: async () => {
      let query = supabase.from("vocab").select("*")
      if (topic) query = query.eq("topic", topic.toLowerCase())
      const { data, error } = await query
      if (error) throw error
      return data
    },
    enabled: false, // Enabled during feature implementation
  })
}
