/**
 * Warm database pool entries. Rows are inserted as warming (which enqueues a db_pool:warm_database job), become ready once provisioned, and are handed to users via metaschema_private.db_pool_claim (invoked by metaschema_public.request_database).
 * @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 { dbPoolKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const dbPoolsQueryKey = dbPoolKeys.list;
export function useDbPoolsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: dbPoolKeys.list(args),
        queryFn: () => getClient().dbPool.findMany(args).unwrap(),
        ...queryOptions,
    });
}
export async function fetchDbPoolsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    return getClient().dbPool.findMany(args).unwrap();
}
export async function prefetchDbPoolsQuery(queryClient, params) {
    const args = buildListSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: dbPoolKeys.list(args),
        queryFn: () => getClient().dbPool.findMany(args).unwrap(),
    });
}
