import { useQuery } from "@tanstack/react-query"; import { api, type AckAggregates, 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). * * The response carries `aggregates` summed over the *full* row set * (not just the visible page) so the KPI strip on the Acks page * reflects every persisted 999 — without this, totals silently * under-report once the row count exceeds the page size. */ export function useAcks(params: { limit?: number; offset?: number } = {}) { return useQuery & { aggregates: AckAggregates }>({ queryKey: ["acks", params], queryFn: () => api.listAcks(params), enabled: api.isConfigured, }); }