/**
 * 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 { Plugin } from '@nocobase/client-v2';
import type { ReactNode } from 'react';
import type { TaskTypeOptions } from './taskCenter';
import type { Instruction } from './canvas/Instruction';
import type { Trigger } from './triggers';
import './models/triggerWorkflows';
export type InstructionGroup = {
    key: string;
    label: string;
};
/**
 * UI location where workflow notices are requested.
 *
 * This is a rendering context hint for non-blocking UI notices; it is not a validation surface and providers should
 * not use it to block workflow execution or saving.
 */
export type WorkflowNoticeSurface = 'workflow-list-row' | 'trigger-node-card';
export type WorkflowNotice = {
    /** Extra explanatory content. List rows render this as tooltip content; compact card surfaces may ignore it. */
    description?: ReactNode;
    /** Stable identity for React rendering and provider-level deduplication. */
    key: string;
    /** Short user-facing notice title. */
    message: ReactNode;
    /** Visual severity. Providers should keep notices informational and side-effect free. */
    type?: 'error' | 'info' | 'success' | 'warning';
};
export type WorkflowNoticeProviderContext = {
    nodes?: Array<Record<string, unknown>>;
    /** The UI surface requesting notices so providers can return copy and density suitable for that location. */
    surface: WorkflowNoticeSurface;
    workflow?: Record<string, unknown> | null;
};
export type WorkflowNoticeResult = WorkflowNotice | WorkflowNotice[] | null | undefined;
export type WorkflowListNoticeProviderContext = {
    api?: unknown;
    surface: 'workflow-list-row';
    workflows: Array<Record<string, unknown>>;
};
export type WorkflowListNoticeMap = Record<string, WorkflowNotice | WorkflowNotice[] | null | undefined>;
export type WorkflowNoticeProviderFunction = (context: WorkflowNoticeProviderContext) => WorkflowNoticeResult;
export type WorkflowNoticeProviderObject = {
    getNotices?: (context: WorkflowNoticeProviderContext) => WorkflowNoticeResult;
    loadWorkflowListNotices?: (context: WorkflowListNoticeProviderContext) => Promise<WorkflowListNoticeMap>;
    shouldLoadWorkflowListNotices?: (context: WorkflowListNoticeProviderContext) => boolean;
};
export type WorkflowNoticeProvider = WorkflowNoticeProviderFunction | WorkflowNoticeProviderObject;
/**
 * A workflow **system variable** (the `$system` scope). Registered by the
 * workflow plugin itself — fixed, framework-independent values (current time,
 * instance id, snowflake id), not contributed by any other plugin. Mirrors v1's
 * `registerSystemVariable` (`client/index.tsx`).
 */
export type SystemVariableOption = {
    /** Registry key + the path segment under `$system` (e.g. `now`). */
    key: string;
    /** Display label. Accepts a plain string or a `{{t("…")}}` template. */
    label: string;
    /** Optional tooltip shown next to the label. */
    tooltip?: string;
};
export declare class PluginWorkflowClientV2 extends Plugin {
    triggers: any;
    instructions: any;
    instructionGroups: any;
    systemVariables: any;
    workflowNoticeProviders: any;
    taskTypes: any;
    /**
     * Register a `$system` scope variable. Mirrors v1's `registerSystemVariable`
     * but writes to *this* (v2) runtime's registry. The workflow plugin registers
     * the builtin ones (time / instance id / snowflake id) on load.
     */
    registerSystemVariable(option: SystemVariableOption): void;
    registerTaskType(key: string, option: Omit<TaskTypeOptions, 'key'> | TaskTypeOptions): void;
    isWorkflowSync(workflow: any): any;
    /**
     * Register a node type's v2 instruction. Mirrors v1's `registerInstruction`
     * signature (accepts a class or an instance) but writes to *this* (v2)
     * runtime's registry — see ADR-0003 / doc §9.1 (runtime separation). A type
     * registered here appears in the v2 add-node menu and renders on the v2 canvas.
     */
    registerInstruction(type: string, instruction: Instruction | {
        new (): Instruction;
    }): void;
    getInstruction(type?: string): any;
    registerInstructionGroup(key: string, group: InstructionGroup): void;
    registerTrigger(type: string, trigger: Trigger | {
        new (): Trigger;
    }): void;
    getTriggerOptions(type?: string): any;
    /**
     * Register a workflow notice provider. Providers should be pure readers of the supplied context; they are queried by
     * UI surfaces such as workflow list rows and trigger node cards.
     */
    registerWorkflowNoticeProvider(key: string, provider: WorkflowNoticeProvider): void;
    /** Collect notices from registered providers for the current UI surface. */
    getWorkflowNotices(context: WorkflowNoticeProviderContext): any[];
    loadWorkflowListNotices(context: WorkflowListNoticeProviderContext): Promise<Record<string, WorkflowNotice[]>>;
    load(): Promise<void>;
    private registerBuiltinSystemVariables;
    private registerBuiltinInstructions;
    private registerModelLoaders;
    private registerBuiltinTriggers;
    private registerSettingsPage;
    private registerCanvasRoute;
    private registerExecutionRoute;
    private registerTaskCenterRoutes;
}
export default PluginWorkflowClientV2;
export type { TaskTypeOptions } from './taskCenter';
