/**
 * Request-time HTTP routing authority: registered domain plus path prefix and optional method to a typed target
 * @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 { httpRouteKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const httpRouteQueryKey = httpRouteKeys.detail;
export function useHttpRouteQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: httpRouteKeys.detail(params.id),
        queryFn: () => getClient()
            .httpRoute.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchHttpRouteQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .httpRoute.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchHttpRouteQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: httpRouteKeys.detail(params.id),
        queryFn: () => getClient()
            .httpRoute.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
