/**
 * Append-only ledger of code redemptions; AFTER INSERT trigger validates and cascades to limit_credits
 * @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 { appLimitCreditRedemptionKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const appLimitCreditRedemptionQueryKey = appLimitCreditRedemptionKeys.detail;
export function useAppLimitCreditRedemptionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: appLimitCreditRedemptionKeys.detail(params.id),
        queryFn: () => getClient()
            .appLimitCreditRedemption.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchAppLimitCreditRedemptionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .appLimitCreditRedemption.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchAppLimitCreditRedemptionQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: appLimitCreditRedemptionKeys.detail(params.id),
        queryFn: () => getClient()
            .appLimitCreditRedemption.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
