/**
 * Single item query hook for FunctionModule
 * @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 { functionModuleKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const functionModuleQueryKey = functionModuleKeys.detail;
export function useFunctionModuleQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: functionModuleKeys.detail(params.id),
        queryFn: () => getClient()
            .functionModule.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchFunctionModuleQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .functionModule.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchFunctionModuleQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: functionModuleKeys.detail(params.id),
        queryFn: () => getClient()
            .functionModule.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
