/**
 * 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 { FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY, type FlowSurfaceApplyBlueprintPopupDefaultsMetadata } from './blueprint/defaults';
import type { FlowSurfaceComposeMode } from './types';
export type FlowSurfaceComposeObject = Record<string, unknown>;
export type FlowSurfaceComposeTargetKey = {
    uid?: string;
};
export type FlowSurfaceComposeNormalizedResource = {
    kind: 'semantic' | 'raw';
    value: FlowSurfaceComposeObject;
} | undefined;
export type FlowSurfaceComposeNormalizedFieldSpec = {
    index?: number;
    key: string;
    fieldPath?: string;
    associationPathName?: string;
    renderer?: string;
    type?: string;
    fieldType?: string;
    fields?: string[];
    titleField?: string;
    openMode?: string;
    popupSize?: string;
    pageSize?: number;
    showIndex?: boolean;
    target?: string | Record<string, unknown>;
    defaultTargetUid?: string;
    targetBlockUid?: string;
    settings?: FlowSurfaceComposeObject;
    popup?: FlowSurfaceComposeObject;
    __autoPopupForRelationField?: boolean;
    [FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]?: FlowSurfaceApplyBlueprintPopupDefaultsMetadata;
};
export type FlowSurfaceComposeNormalizedActionSpec = {
    key: string;
    type: string;
    settings?: FlowSurfaceComposeObject;
    popup?: FlowSurfaceComposeObject;
};
export type FlowSurfaceComposeNormalizedBlockSpec = {
    index?: number;
    key: string;
    type?: string;
    catalogItem?: FlowSurfaceComposeObject | null;
    resource?: FlowSurfaceComposeNormalizedResource;
    template?: FlowSurfaceComposeObject;
    settings?: FlowSurfaceComposeObject;
    explicitFields?: boolean;
    fields: FlowSurfaceComposeNormalizedFieldSpec[];
    fieldsLayout?: FlowSurfaceComposeObject;
    actions: FlowSurfaceComposeNormalizedActionSpec[];
    recordActions: FlowSurfaceComposeNormalizedActionSpec[];
};
export type FlowSurfaceComposeBlockCreatePayload = {
    target: {
        uid: string;
    };
    type?: string;
    resource?: FlowSurfaceComposeObject;
    resourceInit?: FlowSurfaceComposeObject;
    template?: FlowSurfaceComposeObject;
    key?: string;
};
export type FlowSurfaceCompiledComposeBlockTask = {
    key: string;
    spec: FlowSurfaceComposeNormalizedBlockSpec;
    payload: FlowSurfaceComposeBlockCreatePayload;
};
export type FlowSurfaceCompiledComposeFieldTask = {
    blockKey: string;
    spec: FlowSurfaceComposeNormalizedFieldSpec;
    containerSource: 'block' | 'item';
    payload: FlowSurfaceComposeObject;
};
export type FlowSurfaceCompiledComposeActionTask = {
    blockKey: string;
    spec: FlowSurfaceComposeNormalizedActionSpec;
    payload: FlowSurfaceComposeObject;
};
export type FlowSurfaceCompiledComposeRecordActionTask = {
    blockKey: string;
    spec: FlowSurfaceComposeNormalizedActionSpec;
    payload: FlowSurfaceComposeObject;
};
export type FlowSurfaceComposeLayoutPlan = {
    kind: 'none';
} | {
    kind: 'explicit';
    layout?: FlowSurfaceComposeObject;
} | {
    kind: 'append';
};
export type FlowSurfaceCompiledComposePlan = {
    gridUid: string;
    mode: FlowSurfaceComposeMode;
    existingItemUids: string[];
    blocks: FlowSurfaceCompiledComposeBlockTask[];
    fields: FlowSurfaceCompiledComposeFieldTask[];
    actions: FlowSurfaceCompiledComposeActionTask[];
    recordActions: FlowSurfaceCompiledComposeRecordActionTask[];
    layoutPlan: FlowSurfaceComposeLayoutPlan;
};
export declare function compileComposeExecutionPlan(input: {
    gridUid: string;
    mode: FlowSurfaceComposeMode;
    normalizedBlocks: FlowSurfaceComposeNormalizedBlockSpec[];
    existingItemUids?: string[];
    layout?: FlowSurfaceComposeObject;
}): FlowSurfaceCompiledComposePlan;
export declare function resolveComposeFieldContainerSource(blockSpec: Pick<FlowSurfaceComposeNormalizedBlockSpec, 'type'>): 'block' | 'item';
export declare function resolveComposeTargetKey(targetKey: string, keyMap: Record<string, FlowSurfaceComposeTargetKey | undefined>, kind: string): string;
