/**
 * Tracks individual construction attempts of a blueprint. Each time construct_blueprint() is called, a new record is created here. This separates the editable blueprint definition from its build history, allowing blueprints to be re-executed, constructed into multiple databases, and maintain an audit trail of all construction attempts.
 * @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 { blueprintConstructionKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const blueprintConstructionQueryKey = blueprintConstructionKeys.detail;
export function useBlueprintConstructionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: blueprintConstructionKeys.detail(params.id),
        queryFn: () => getClient()
            .blueprintConstruction.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchBlueprintConstructionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .blueprintConstruction.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchBlueprintConstructionQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: blueprintConstructionKeys.detail(params.id),
        queryFn: () => getClient()
            .blueprintConstruction.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
