/**
 * 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 FlowSurfaceCompiledComposePlan, type FlowSurfaceComposeNormalizedActionSpec, type FlowSurfaceComposeNormalizedBlockSpec, type FlowSurfaceComposeNormalizedFieldSpec, type FlowSurfaceComposeObject, type FlowSurfaceComposeTargetKey } from './compose-compiler';
export type FlowSurfaceComposeBlockResult = {
    uid: string;
    gridUid?: string;
    itemUid?: string;
    itemGridUid?: string;
    actionsColumnUid?: string;
};
export type FlowSurfaceComposeFieldResult = {
    uid?: string;
    wrapperUid?: string;
    fieldUid?: string;
    innerFieldUid?: string;
    popupPageUid?: string;
    popupTabUid?: string;
    popupGridUid?: string;
};
export type FlowSurfaceComposeActionResult = {
    uid: string;
    parentUid?: string;
    scope?: string;
};
export type FlowSurfaceComposeRuntimeBlockState = {
    spec: FlowSurfaceComposeNormalizedBlockSpec;
    result: FlowSurfaceComposeBlockResult;
    createdFields: Array<{
        spec: FlowSurfaceComposeNormalizedFieldSpec;
        result: FlowSurfaceComposeFieldResult;
    }>;
    fieldResults: Array<Record<string, unknown>>;
    actionResults: Array<Record<string, unknown>>;
    recordActionResults: Array<Record<string, unknown>>;
};
export type FlowSurfaceComposeRuntimeState = {
    keyMap: Record<string, FlowSurfaceComposeTargetKey & Partial<FlowSurfaceComposeBlockResult>>;
    blocks: FlowSurfaceComposeRuntimeBlockState[];
};
export type FlowSurfaceComposeExecutionResult = {
    target: {
        uid: string;
    };
    mode: FlowSurfaceCompiledComposePlan['mode'];
    blocks: Array<{
        key: string;
        type?: string;
        uid: string;
        gridUid?: string;
        itemUid?: string;
        itemGridUid?: string;
        actionsColumnUid?: string;
        fields: Array<Record<string, unknown>>;
        actions: Array<Record<string, unknown>>;
        recordActions: Array<Record<string, unknown>>;
    }>;
    layout?: unknown;
};
export type FlowSurfaceComposeRuntimeDeps = {
    removeExistingItem?: (uid: string) => Promise<void>;
    createBlock: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedBlockSpec) => Promise<FlowSurfaceComposeBlockResult>;
    applyNodeSettings?: (actionName: string, targetUid: string | undefined, settings?: FlowSurfaceComposeObject) => Promise<void>;
    resolveBlockSettings?: (settings: FlowSurfaceComposeObject, state: FlowSurfaceComposeRuntimeState, block: FlowSurfaceComposeRuntimeBlockState) => FlowSurfaceComposeObject | Promise<FlowSurfaceComposeObject>;
    resolveActionSettings?: (settings: FlowSurfaceComposeObject, state: FlowSurfaceComposeRuntimeState, block: FlowSurfaceComposeRuntimeBlockState, action: FlowSurfaceComposeNormalizedActionSpec, actionName: string) => FlowSurfaceComposeObject | Promise<FlowSurfaceComposeObject>;
    createField: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedFieldSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise<FlowSurfaceComposeFieldResult | null>;
    applyFieldSettings?: (actionName: string, result: FlowSurfaceComposeFieldResult, settings?: FlowSurfaceComposeObject) => Promise<void>;
    onFieldError?: (input: {
        error: unknown;
        spec: FlowSurfaceComposeNormalizedFieldSpec;
        blockSpec: FlowSurfaceComposeNormalizedBlockSpec;
        blockResult: FlowSurfaceComposeBlockResult;
    }) => Promise<'continue' | void> | 'continue' | void;
    createAction: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedActionSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise<FlowSurfaceComposeActionResult>;
    createRecordAction: (payload: Record<string, unknown>, spec: FlowSurfaceComposeNormalizedActionSpec, blockResult: FlowSurfaceComposeBlockResult) => Promise<FlowSurfaceComposeActionResult>;
    applyActionPopup?: (actionName: string, actionUid: string, popup?: FlowSurfaceComposeObject) => Promise<void>;
    collectActionKeys?: (actionUid: string) => Promise<Record<string, unknown>>;
    buildExplicitLayoutPayload?: (input: {
        layout?: FlowSurfaceComposeObject;
        createdByKey: Record<string, FlowSurfaceComposeTargetKey & Partial<FlowSurfaceComposeBlockResult>>;
        targetUid: string;
    }) => Promise<Record<string, unknown>> | Record<string, unknown>;
    buildAppendLayoutPayload?: (input: {
        gridUid: string;
        appendedItemUids: string[];
    }) => Promise<Record<string, unknown>> | Record<string, unknown>;
    setLayout?: (payload: Record<string, unknown>) => Promise<unknown>;
};
export declare function executeComposeRuntime(plan: FlowSurfaceCompiledComposePlan, deps: FlowSurfaceComposeRuntimeDeps): Promise<FlowSurfaceComposeExecutionResult>;
export declare function createComposeRuntimeState(): FlowSurfaceComposeRuntimeState;
