/**
 * Records of individual permission grants and revocations for members via bitmask
 * @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 { appGrantKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const appGrantQueryKey = appGrantKeys.detail;
export function useAppGrantQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: appGrantKeys.detail(params.id),
        queryFn: () => getClient()
            .appGrant.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchAppGrantQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .appGrant.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchAppGrantQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: appGrantKeys.detail(params.id),
        queryFn: () => getClient()
            .appGrant.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
