/**
 * Custom query hook for getObjectAtPath
 * @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 { customQueryKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const getObjectAtPathQueryKey = customQueryKeys.getObjectAtPath;
export function useGetObjectAtPathQuery(params) {
    const variables = params.variables ?? {};
    const args = buildSelectionArgs(params.selection);
    const { variables: _variables, selection: _selection, ...queryOptions } = params ?? {};
    void _variables;
    void _selection;
    return useQuery({
        queryKey: getObjectAtPathQueryKey(variables),
        queryFn: () => getClient()
            .query.getObjectAtPath(variables, {
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchGetObjectAtPathQuery(params) {
    const variables = params.variables ?? {};
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .query.getObjectAtPath(variables, {
        select: args.select,
    })
        .unwrap();
}
export async function prefetchGetObjectAtPathQuery(queryClient, params) {
    const variables = params.variables ?? {};
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: getObjectAtPathQueryKey(variables),
        queryFn: () => getClient()
            .query.getObjectAtPath(variables, {
            select: args.select,
        })
            .unwrap(),
    });
}
