import { useQuery } from '@tanstack/react-query'
import { heaps as heapsApi, type Heap } from '../services/api'

export const HEAPS_QUERY_KEY = ['heaps'] as const

export function useHeapsQuery() {
  return useQuery<Heap[]>({
    queryKey: HEAPS_QUERY_KEY,
    queryFn: heapsApi.list,
    staleTime: 30_000,
  })
}
