/**
 * Function deployment bindings — ties a function definition to a namespace for Knative provisioning and routing
 * @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 { functionDeploymentKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const functionDeploymentQueryKey = functionDeploymentKeys.detail;
export function useFunctionDeploymentQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: functionDeploymentKeys.detail(params.id),
        queryFn: () => getClient()
            .functionDeployment.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchFunctionDeploymentQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .functionDeployment.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchFunctionDeploymentQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: functionDeploymentKeys.detail(params.id),
        queryFn: () => getClient()
            .functionDeployment.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
