/**
 * 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 { useMutation, useQueryClient } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildSelectionArgs } from '../selection';
import { blueprintConstructionKeys } from '../query-keys';
import { blueprintConstructionMutationKeys } from '../mutation-keys';
export function useCreateBlueprintConstructionMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: blueprintConstructionMutationKeys.create(),
        mutationFn: (data) => getClient()
            .blueprintConstruction.create({
            data,
            select: args.select,
        })
            .unwrap(),
        onSuccess: () => {
            queryClient.invalidateQueries({
                queryKey: blueprintConstructionKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
