/**
 * Append-only log of limit events for historical reporting and audit
 * @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 { orgLimitEventKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const orgLimitEventQueryKey = orgLimitEventKeys.detail;
export function useOrgLimitEventQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: orgLimitEventKeys.detail(params.id),
        queryFn: () => getClient()
            .orgLimitEvent.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchOrgLimitEventQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .orgLimitEvent.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchOrgLimitEventQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: orgLimitEventKeys.detail(params.id),
        queryFn: () => getClient()
            .orgLimitEvent.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
