/**
 * DO INSTEAD rules for views (e.g., read-only enforcement)
 * @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 { viewRuleKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const viewRulesQueryKey = viewRuleKeys.list;
export function useViewRulesQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: viewRuleKeys.list(args),
        queryFn: () => getClient().viewRule.findMany(args).unwrap(),
        ...queryOptions,
    });
}
export async function fetchViewRulesQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    return getClient().viewRule.findMany(args).unwrap();
}
export async function prefetchViewRulesQuery(queryClient, params) {
    const args = buildListSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: viewRuleKeys.list(args),
        queryFn: () => getClient().viewRule.findMany(args).unwrap(),
    });
}
