/**
 * List query hook for ViewGrant
 * @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 { viewGrantKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const viewGrantsQueryKey = viewGrantKeys.list;
export function useViewGrantsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: viewGrantKeys.list(args),
        queryFn: () => getClient().viewGrant.findMany(args).unwrap(),
        ...queryOptions,
    });
}
export async function fetchViewGrantsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    return getClient().viewGrant.findMany(args).unwrap();
}
export async function prefetchViewGrantsQuery(queryClient, params) {
    const args = buildListSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: viewGrantKeys.list(args),
        queryFn: () => getClient().viewGrant.findMany(args).unwrap(),
    });
}
