/**
 * 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 { appLimitEventKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const appLimitEventQueryKey = appLimitEventKeys.detail;
export function useAppLimitEventQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: appLimitEventKeys.detail(params.id),
        queryFn: () => getClient()
            .appLimitEvent.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchAppLimitEventQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .appLimitEvent.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchAppLimitEventQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: appLimitEventKeys.detail(params.id),
        queryFn: () => getClient()
            .appLimitEvent.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
