/**
 * Defines available permissions as named bits within a bitmask, used by the RBAC system for access control
 * @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 { orgPermissionKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const orgPermissionsQueryKey = orgPermissionKeys.list;
export function useOrgPermissionsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: orgPermissionKeys.list(args),
        queryFn: () => getClient().orgPermission.findMany(args).unwrap(),
        ...queryOptions,
    });
}
export async function fetchOrgPermissionsQuery(params) {
    const args = buildListSelectionArgs(params.selection);
    return getClient().orgPermission.findMany(args).unwrap();
}
export async function prefetchOrgPermissionsQuery(queryClient, params) {
    const args = buildListSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: orgPermissionKeys.list(args),
        queryFn: () => getClient().orgPermission.findMany(args).unwrap(),
    });
}
