import { useQuery } from "@tanstack/react-query";
import { api, type PaginatedResponse } from "@/lib/api";
import type { Ack } from "@/types";

/**
 * Lists 999 ACKs, newest first. Mirrors `useRemittances` but
 * intentionally has no in-memory fallback (there is no zustand
 * sample-data path for ACKs in v1 — the UI is empty until the
 * backend serves real rows).
 */
export function useAcks(params: { limit?: number } = {}) {
  return useQuery<PaginatedResponse<Ack>>({
    queryKey: ["acks", params],
    queryFn: () => api.listAcks(params),
    enabled: api.isConfigured,
  });
}
