import { VariableDefine } from '@easy-coder/sdk/variable';
import { FlowData } from '../manager/type';
import { FlowNode } from '../type';

export interface BaseFlowStatic {
    Type: string;
    new (flow: FlowData<any>): BaseFlow;
}
export interface BaseFlow {
    readonly flow: FlowData<any>;
    readonly context: Record<string, any>;
    readonly contextDefine: Record<string, VariableDefine.Desc>;
    readonly extra: Record<string, any>;
    getNodeByName(nodeName: string): FlowNode | undefined;
    addExtra: (key: string, v: any) => void;
    getExtra: <T>(key: string) => T;
    execute(input?: Record<string, any>): Promise<{
        code: number;
        msg: string;
        data?: any;
    }>;
}
export interface FlowNodeOptions<P = any> {
    node: FlowNode<P>;
    flow: BaseFlow;
}
export interface BaseFlowNodeStatic {
    Type: string;
    new (option: FlowNodeOptions): BaseFlowNode;
}
export interface BaseFlowNode {
    readonly option: FlowNodeOptions;
    execute(): Promise<void>;
}
