/**
 * Installed resource bundle ("release") — groups a set of resources; params are merkle-versioned in the scope's shared infra store for rollback
 * @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 { resourceInstallationKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const resourceInstallationQueryKey = resourceInstallationKeys.detail;
export function useResourceInstallationQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: resourceInstallationKeys.detail(params.id),
        queryFn: () => getClient()
            .resourceInstallation.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchResourceInstallationQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .resourceInstallation.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchResourceInstallationQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: resourceInstallationKeys.detail(params.id),
        queryFn: () => getClient()
            .resourceInstallation.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
