/**
 * Periodic snapshot of a single metric for a database. Collected by the snapshot_usage() cron job in constructive-limits. Each row records one metric measurement (e.g. reads, writes, storage_bytes) at a point in time, with optional dimensions for sub-metric breakdowns.
 * @generated by @constructive-io/graphql-codegen
 * DO NOT EDIT - changes will be overwritten
 */
import { useQuery } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildListSelectionArgs } from '../selection';
import { usageSnapshotKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const usageSnapshotsQueryKey = usageSnapshotKeys.list;
export function useUsageSnapshotsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: usageSnapshotKeys.list(args),
        queryFn: () => getClient().usageSnapshot.findMany(args).unwrap(),
        ...queryOptions,
    });
}
export async function fetchUsageSnapshotsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    return getClient().usageSnapshot.findMany(args).unwrap();
}
export async function prefetchUsageSnapshotsQuery(queryClient, params) {
    const args = buildListSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: usageSnapshotKeys.list(args),
        queryFn: () => getClient().usageSnapshot.findMany(args).unwrap(),
    });
}
