/**
 * Provisions security, fields, grants, and policies onto a table. Each row can independently: (1) create fields via nodes[] array (supporting multiple Data* modules per row), (2) grant privileges via grants[] array (supporting per-role privilege targeting), (3) create RLS policies via policies[] array (supporting multiple Authz* policies per row). Multiple rows can target the same table to compose different concerns. All three concerns are optional and independent.
 * @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 { secureTableProvisionKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const secureTableProvisionQueryKey = secureTableProvisionKeys.detail;
export function useSecureTableProvisionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: secureTableProvisionKeys.detail(params.id),
        queryFn: () => getClient()
            .secureTableProvision.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchSecureTableProvisionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .secureTableProvision.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchSecureTableProvisionQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: secureTableProvisionKeys.detail(params.id),
        queryFn: () => getClient()
            .secureTableProvision.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
