import type { QueryClient } from "@tanstack/react-query";
import { qk } from "./queryKeys";

// The download queue, the per-card download index, and the storage-usage meter all move together
// whenever a job is enqueued, deleted, or its state changes — invalidate them as one unit.
export function invalidateDownloads(qc: QueryClient) {
  qc.invalidateQueries({ queryKey: qk.downloads() });
  qc.invalidateQueries({ queryKey: qk.downloadIndex() });
  qc.invalidateQueries({ queryKey: qk.downloadUsage() });
}
