/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */
import type { Instruction } from './Instruction';
import type { SharedAddNodeAnchor } from './AddNodeContext.shared';
export type AddNodeControllerRuntime = {
    workflow: any;
    nodes: any[];
    getInstruction: (type: string) => Instruction | undefined;
    getInstructionAvailable?: (instruction: Instruction, context: Record<string, any>) => string | null;
    translateTitle: (title: string) => string;
    api: any;
    refresh?: () => void;
};
export type AddNodeDraft = {
    key: string;
    type: string;
    upstreamId: any;
    branchIndex: number | null | undefined;
    title: string;
    config: Record<string, any>;
};
export type AddNodeDecision = {
    kind: 'missing';
    type: string;
} | {
    kind: 'blocked';
    message: string;
    instruction: Instruction;
} | {
    kind: 'legacy-preset';
    instruction: Instruction;
    draft: AddNodeDraft;
} | {
    kind: 'modern-preset';
    instruction: Instruction;
    anchor: SharedAddNodeAnchor;
    hasDownstream: boolean;
} | {
    kind: 'branch-fallback';
    instruction: Instruction;
    draft: AddNodeDraft;
} | {
    kind: 'direct';
    instruction: Instruction;
    draft: AddNodeDraft;
};
export declare function findDownstream(nodes?: any[], upstream?: any, branchIndex?: number | null): any;
export declare function createNodeDraft({ instruction, anchor, translateTitle, }: {
    instruction: Instruction;
    anchor: SharedAddNodeAnchor;
    translateTitle: (title: string) => string;
}): AddNodeDraft;
export declare function resolveAddNodeDecision({ type, anchor, runtime, }: {
    type: string;
    anchor: SharedAddNodeAnchor;
    runtime: Pick<AddNodeControllerRuntime, 'workflow' | 'nodes' | 'getInstruction' | 'getInstructionAvailable' | 'translateTitle'>;
}): AddNodeDecision;
export declare function createNodeAndMaybeReparent({ workflowId, api, refresh, values, downstreamBranchIndex, }: {
    workflowId: any;
    api: any;
    refresh?: () => void;
    values: Record<string, any>;
    downstreamBranchIndex?: number | null;
}): Promise<any>;
