/**
 * Tracks database provisioning requests and their status. The BEFORE INSERT trigger creates the database and sets database_id before RLS policies are evaluated.
 * @generated by @constructive-io/graphql-codegen
 * DO NOT EDIT - changes will be overwritten
 */
import { useQuery } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildSelectionArgs } from '../selection';
import { databaseProvisionModuleKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const databaseProvisionModuleQueryKey = databaseProvisionModuleKeys.detail;
export function useDatabaseProvisionModuleQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: databaseProvisionModuleKeys.detail(params.id),
        queryFn: () => getClient()
            .databaseProvisionModule.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchDatabaseProvisionModuleQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .databaseProvisionModule.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchDatabaseProvisionModuleQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: databaseProvisionModuleKeys.detail(params.id),
        queryFn: () => getClient()
            .databaseProvisionModule.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
