import * as rxjs from 'rxjs';
import { Observable } from 'rxjs';
import * as i0 from '@angular/core';
import { Type, ModuleWithProviders, Injector, InjectionToken } from '@angular/core';
import { AXPValidationRules, AXPEntityOp, AXPCategoryEntity, AXPExpressionEvaluatorScope } from '@acorex/platform/core';
import { AXPWidgetTypesMap } from '@acorex/platform/layout/widget-core';
import { AXPCommand, AXPExecuteCommandResultPromise } from '@acorex/platform/runtime';

declare class AXPWorkflowError extends Error {
    inner: Error | null;
    constructor(message: string, inner?: Error | null);
}

interface AXPWorkflow {
    steps: {
        [stepName: string]: AXPWorkflowStep;
    };
    startStepId: string;
}
declare class AXPWorkflowContext {
    constructor(initialData?: any);
    private variables;
    private stepOutputs;
    setVariable(key: string, value: any): void;
    setVariables(context?: any): void;
    getVariable<T = any>(key?: string | null): T;
    setOutput(key: string, output: any): void;
    setOutputs(values: Map<string, any>): void;
    getOutput<T = any>(key: string): T;
}
type AXPWorkflowActionInput = any;
type AXPWorkflowConditionType = 'AND' | 'OR' | 'SINGLE';
interface AXPWorkflowCondition {
    type: AXPWorkflowConditionType;
    conditions?: AXPWorkflowCondition[];
    expression?: string;
}
interface AXPWorkflowNextStep {
    conditions: AXPWorkflowCondition[];
    nextStepId: string;
}
interface AXPWorkflowStep {
    id?: string;
    action: AXPWorkflowAction | string;
    input?: AXPWorkflowActionInput;
    nextSteps?: AXPWorkflowNextStep[];
    conditions?: AXPWorkflowCondition[];
}
declare abstract class AXPWorkflowAction {
    private eventService;
    protected dispatch(event: AXPWorkflowEvent): void;
    abstract execute(context: AXPWorkflowContext): Promise<void>;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowAction, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowAction>;
}
declare abstract class AXPWorkflowFunction {
    abstract execute(...args: any[]): Promise<any> | any;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowFunction, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowFunction>;
}
interface AXPWorkflowEvent<T = any> {
    type: string;
    payload?: T;
}
declare function createWorkFlowEvent<T>(type: string): {
    (payload: T): {
        type: string;
        payload: T;
    };
    type: string;
};
declare function ofType<T extends {
    type: string;
}>(...allowedTypes: Array<{
    type: string;
}>): rxjs.MonoTypeOperatorFunction<T>;

declare class AXPWorkflowEventService {
    private eventSubject;
    dispatch(event: AXPWorkflowEvent): void;
    get events$(): Observable<AXPWorkflowEvent>;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowEventService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowEventService>;
}

declare class AXPWorkflowRegistryService {
    private functionsMap;
    private actionsMap;
    private workflowsMap;
    registerWorkflow(name: string, workflow: AXPWorkflow): void;
    getWorkflow(name: string): AXPWorkflow | undefined;
    registerAction(name: string, action: Type<AXPWorkflowAction>): void;
    getAction(name: string): Type<AXPWorkflowAction> | undefined;
    registerFunction(name: string, func: Type<AXPWorkflowFunction>): void;
    getFunction(name: string): Type<AXPWorkflowFunction> | undefined;
    getFunctionNames(): string[];
    getStep(workflowName: string, stepName: string): AXPWorkflowStep | undefined;
    updateStepInWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void;
    addStepToWorkflow(workflowName: string, stepName: string, step: AXPWorkflowStep): void;
    addAfterStep(workflowId: string, stepId: string, newStepId: string, newStepAction: string, conditionExpression: string): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowRegistryService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowRegistryService>;
}

interface AXPWorkflowModuleConfigs {
    functions?: {
        [name: string]: Type<AXPWorkflowFunction>;
    };
    actions?: {
        [name: string]: Type<AXPWorkflowAction>;
    };
    workflows?: {
        [name: string]: AXPWorkflow;
    };
}
declare class AXPWorkflowModule {
    static forRoot(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
    static forChild(config?: AXPWorkflowModuleConfigs): ModuleWithProviders<AXPWorkflowModule>;
    /**
     * @ignore
     */
    constructor(instances: any[]);
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowModule, [{ optional: true; }]>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<AXPWorkflowModule, never, never, never>;
    static ɵinj: i0.ɵɵInjectorDeclaration<AXPWorkflowModule>;
}

declare class AXPWorkflowService {
    private registryService;
    private injector;
    private eventService;
    get events$(): Observable<AXPWorkflowEvent>;
    constructor(registryService: AXPWorkflowRegistryService, injector: Injector);
    exists(name: string): boolean;
    execute(workflow: AXPWorkflow | string, initialContext?: AXPWorkflowContext | any | null): Promise<AXPWorkflowContext>;
    private processData;
    private getActionInstance;
    private getWorkflowInstance;
    private determineNextStep;
    private evaluateCondition;
    private evaluateSingleCondition;
    private evaluateExpression;
    private processInputs;
    private createFunctionScope;
    private getFunctionInstance;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowService>;
}

interface AXPWorkflowDefinition {
    schemaVersion: "acorex-platform-workflow/v1";
    name: string;
    title?: string | null;
    description?: string | null;
    variables?: AXPVariableDefinition[];
    inputs?: AXPWorkflowInputDescriptor[];
    outputs?: AXPWorkflowOutputDescriptor[];
    graph: AXPWorkflowGraph;
    customProperties?: Record<string, any>;
    /** engine specific (Elsa, ...) */
    extensions?: AXPWorkflowExtensions;
    /**
     * Workflow bindings configuration.
     * Defines which entities and events should trigger this workflow.
     */
    bindings?: AXPWorkflowBinding[];
}
interface AXPWorkflowGraph {
    startActivityId: string;
    activities: AXPWorkflowActivityInstance[];
    connections: AXPConnection[];
    /** purely designer */
    designer?: {
        nodes?: Record<string, {
            x: number;
            y: number;
            nodeId?: string;
        }>;
        edges?: Array<{
            from: string;
            to: string;
            vertices?: Array<{
                x: number;
                y: number;
            }>;
        }>;
    };
}
interface AXPWorkflowActivityInstance {
    id: string;
    nodeId?: string;
    /**
     * Activity name - references AXPActivityDefinition.name
     * Used to lookup activity definition for metadata (executionMode, title, etc.)
     */
    name: string;
    /**
     * Input values for this activity instance.
     * Key-value pairs where keys match input descriptor names from AXPActivityDefinition.inputs
     * Example: { "message": "Hello", "duration": 5000 }
     */
    inputs?: Record<string, any>;
    metadata?: Record<string, any>;
    customProperties?: Record<string, any>;
    /** engine-specific override */
    extensions?: Record<string, any>;
}
interface AXPConnection {
    source: {
        activtyName: string;
        port?: string | null;
    };
    target: {
        activtyName: string;
        port?: string | null;
    };
    vertices?: Array<{
        x: number;
        y: number;
    }>;
}
interface AXPVariableDefinition {
    name: string;
    type: string;
    isArray?: boolean;
    value?: any;
    storageDriverType?: string | null;
}
interface AXPWorkflowPropertyWidget {
    type: AXPWidgetTypesMap[keyof AXPWidgetTypesMap] | string;
    options?: Record<string, any>;
}
interface AXPWorkflowInputDescriptor {
    name: string;
    title: string;
    description?: string;
    schema: {
        dataType: string;
        isArray?: boolean;
        nullable?: boolean;
        readonly?: boolean;
        hidden?: boolean | string;
        defaultValue?: any | string | ((context: any | null) => any);
        interface: AXPWorkflowPropertyWidget;
    };
    validations?: AXPValidationRules;
}
interface AXPWorkflowOutputDescriptor {
    name: string;
    title: string;
    description?: string;
    /**
    * Optional: where this output comes from in your context/memory.
    * Example: "$.result.orderId" or "vars.orderId"
    */
    path?: string;
    metadata?: Record<string, any>;
    schema: {
        isArray?: boolean;
        dataType: string;
    };
}
/**
 * Engine-specific extension bag for a workflow.
 * Keep ALL engine-only fields here (Elsa, StepFunctions adapter, etc).
 */
interface AXPWorkflowExtensions {
    /**
     * Elsa-specific extensions (optional).
     */
    elsa?: AXPElsaWorkflowExtensions;
    /**
     * Other engines (future-proof).
     * Example: stepFunctions, logicApps, temporal, ...
     */
    [engine: string]: any;
}
/**
 * Elsa-only fields (Optional).
 * Put strategy/tool/schema/raw payload here to keep Core model global.
 */
interface AXPElsaWorkflowExtensions {
    /**
     * Elsa schema URL (if you want to round-trip exact docs).
     * Example: "https://elsaworkflows.io/schemas/workflow-definition/v3.0.0/schema.json"
     */
    schema?: string;
    toolVersion?: string;
    materializerName?: string;
    /**
     * Elsa strategy/options (engine-level concerns).
     */
    options?: {
        activationStrategyType?: string | null;
        incidentStrategyType?: string | null;
        commitStrategyName?: string | null;
        autoUpdateConsumingWorkflows?: boolean;
        usableAsActivity?: boolean | null;
        activityCategory?: string | null;
    };
    /**
     * If you want lossless Elsa round-trip, keep the raw Elsa definition here.
     */
    rawDefinition?: any;
}
/**
 * Workflow binding configuration.
 * Defines which entities and events should trigger a workflow.
 */
interface AXPWorkflowBinding {
    /**
     * Entity types this workflow applies to (e.g., ['ContentManagement.Promotion', 'ContentManagement.Article'])
     * Empty array means applies to all entities with workflow plugin enabled.
     */
    entityTypes: string[];
    /**
     * Event types that trigger this workflow (e.g., ['create', 'update'])
     * Uses AXPEntityOp directly (create, update, delete, etc.)
     */
    eventTypes: AXPEntityOp[];
    /**
     * Whether this binding is enabled
     */
    enabled: boolean;
    /**
     * Optional conditions for when to trigger (future enhancement)
     */
    conditions?: any;
}

/**
 * Workflow status.
 */
type AXPWorkflowStatus = 'Running' | 'Finished';
/**
 * Workflow sub-status.
 */
type AXPWorkflowSubStatus = 'Pending' | 'Executing' | 'Suspended' | 'Finished' | 'Cancelled' | 'Faulted';
/**
 * Activity status.
 */
type AXPActivityStatus = 'Running' | 'Completed' | 'Canceled' | 'Faulted';
/**
 * Exception state.
 */
interface AXPExceptionState {
    /**
     * Exception type name.
     */
    type: string;
    /**
     * Exception message.
     */
    message: string;
    /**
     * Stack trace (nullable).
     */
    stackTrace?: string | null;
    /**
     * Inner exception (nullable).
     */
    innerException?: AXPExceptionState | null;
}
/**
 * Activity incident.
 */
interface AXPActivityIncident {
    /**
     * Activity ID that caused the incident.
     */
    activityId: string;
    /**
     * Activity node ID.
     */
    activityNodeId: string;
    /**
     * Activity type.
     */
    activityType: string;
    /**
     * Incident message.
     */
    message: string;
    /**
     * Exception (nullable).
     */
    exception?: AXPExceptionState | null;
    /**
     * Timestamp (ISO date-time).
     */
    timestamp: string;
}
/**
 * Workflow fault state.
 */
interface AXPWorkflowFaultState {
    /**
     * Exception (nullable).
     */
    exception?: AXPExceptionState | null;
    /**
     * Fault message.
     */
    message: string;
    /**
     * Faulted activity ID (nullable).
     */
    faultedActivityId?: string | null;
}
/**
 * Bookmark.
 */
interface AXPBookmark {
    /**
     * Bookmark ID.
     */
    id: string;
    /**
     * Bookmark name.
     */
    name: string;
    /**
     * Bookmark hash.
     */
    hash: string;
    /**
     * Bookmark payload (nullable).
     */
    payload?: any | null;
    /**
     * Activity node ID.
     */
    activityNodeId: string;
    /**
     * Activity instance ID.
     */
    activityInstanceId: string;
    /**
     * Auto burn flag.
     */
    autoBurn?: boolean;
    /**
     * Callback method name (nullable).
     */
    callbackMethodName?: string | null;
    /**
     * Metadata (nullable).
     */
    metadata?: Record<string, string> | null;
}
/**
 * Completion callback state.
 */
interface AXPCompletionCallbackState {
    /**
     * Owner activity instance ID.
     */
    ownerInstanceId: string;
    /**
     * Child activity node ID.
     */
    childNodeId: string;
    /**
     * Method name (nullable).
     */
    methodName?: string | null;
}
/**
 * Variable (for activity context).
 */
interface AXPActivityVariable {
    /**
     * Variable ID.
     */
    id: string;
    /**
     * Variable name.
     */
    name: string;
    /**
     * Type name.
     */
    typeName: string;
    /**
     * Is array flag.
     */
    isArray?: boolean;
    /**
     * Variable value (nullable).
     */
    value?: any | null;
    /**
     * Storage driver type name (nullable).
     */
    storageDriverTypeName?: string | null;
}
/**
 * Activity execution context state.
 */
interface AXPActivityExecutionContextState {
    /**
     * Context ID (activity instance ID).
     */
    id: string;
    /**
     * Parent context ID (nullable).
     */
    parentContextId?: string | null;
    /**
     * Scheduled activity node ID.
     */
    scheduledActivityNodeId: string;
    /**
     * Owner activity node ID (nullable).
     */
    ownerActivityNodeId?: string | null;
    /**
     * Properties bag.
     */
    properties: Record<string, any>;
    /**
     * Activity state (evaluated properties) (nullable).
     */
    activityState?: Record<string, any> | null;
    /**
     * Dynamic variables.
     */
    dynamicVariables: AXPActivityVariable[];
    /**
     * Activity status.
     */
    status: AXPActivityStatus;
    /**
     * Is executing flag.
     */
    isExecuting: boolean;
    /**
     * Fault count.
     */
    faultCount: number;
    /**
     * Started at timestamp (ISO date-time).
     */
    startedAt: string;
    /**
     * Completed at timestamp (ISO date-time, nullable).
     */
    completedAt?: string | null;
    /**
     * Tag (nullable).
     */
    tag?: any | null;
}
/**
 * Workflow state (internal execution state).
 */
interface AXPWorkflowState {
    /**
     * State ID.
     */
    id: string;
    /**
     * Workflow definition ID.
     */
    definitionId: string;
    /**
     * Workflow definition version.
     */
    definitionVersion: number;
    /**
     * Correlation ID (nullable).
     */
    correlationId?: string | null;
    /**
     * Workflow status.
     */
    status: AXPWorkflowStatus;
    /**
     * Workflow sub-status.
     */
    subStatus: AXPWorkflowSubStatus;
    /**
     * Bookmarks.
     */
    bookmarks: AXPBookmark[];
    /**
     * Incidents.
     */
    incidents: AXPActivityIncident[];
    /**
     * Fault (nullable).
     */
    fault?: AXPWorkflowFaultState | null;
    /**
     * Completion callbacks.
     */
    completionCallbacks: AXPCompletionCallbackState[];
    /**
     * Activity execution contexts.
     */
    activityExecutionContexts: AXPActivityExecutionContextState[];
    /**
     * Input data.
     */
    input: Record<string, any>;
    /**
     * Output data.
     */
    output: Record<string, any>;
    /**
     * Properties bag.
     */
    properties: Record<string, any>;
    /**
     * Created at timestamp (ISO date-time).
     */
    createdAt: string;
    /**
     * Updated at timestamp (ISO date-time).
     */
    updatedAt: string;
    /**
     * Finished at timestamp (ISO date-time, nullable).
     */
    finishedAt?: string | null;
}
/**
 * Workflow instance (stored in database).
 * This matches the Elsa Workflow Instance schema for backend compatibility.
 */
interface AXPWorkflowInstance {
    /**
     * Schema reference.
     */
    $schema?: string;
    /**
     * Unique instance ID.
     */
    id: string;
    /**
     * Workflow definition ID.
     */
    definitionId: string;
    /**
     * Workflow definition version ID.
     */
    definitionVersionId: string;
    /**
     * Workflow definition version number.
     */
    version: number;
    /**
     * Parent workflow instance ID (nullable, for child workflows).
     */
    parentWorkflowInstanceId?: string | null;
    /**
     * Workflow state (internal execution state).
     */
    workflowState: AXPWorkflowState;
    /**
     * Workflow status.
     */
    status: AXPWorkflowStatus;
    /**
     * Workflow sub-status.
     */
    subStatus: AXPWorkflowSubStatus;
    /**
     * Correlation ID (nullable).
     */
    correlationId?: string | null;
    /**
     * Instance name (nullable).
     */
    name?: string | null;
    /**
     * Incident count.
     */
    incidentCount: number;
    /**
     * Created at timestamp (ISO date-time).
     */
    createdAt: string;
    /**
     * Updated at timestamp (ISO date-time).
     */
    updatedAt: string;
    /**
     * Finished at timestamp (ISO date-time, nullable).
     */
    finishedAt?: string | null;
    /**
     * Entity reference ID (for linking workflow instances to business entities).
     */
    entityRefId?: string | null;
    /**
     * Entity reference type (e.g., 'HumanCapitalManagement.LeaveRequest').
     */
    entityRefType?: string | null;
}

/**
 * Type of task for inbox handling.
 * - 'human-task': Requires inbox - needs human interaction
 * - 'ui-activity': UI-only activity (no inbox) - immediate execution
 * - 'system-activity': System/backend activity (no inbox) - automated execution
 */
type AXPTaskType = 'human-task' | 'ui-activity' | 'system-activity';
/**
 * Activity Category - Extends AXPCategoryEntity for consistency and performance
 *
 * Inherited properties from AXPCategoryEntity:
 * - id: string                   - Unique identifier
 * - title: string                - Display name
 * - description?: string         - Category description
 * - parentId?: string            - Parent category ID
 * - childrenCount: number        - Direct child categories count (enables lazy loading)
 * - itemsCount?: number          - Direct activities count
 * - totalChildrenCount?: number  - Total nested categories (optional, for analytics)
 * - totalItemsCount?: number     - Total activities in tree (optional, for analytics)
 */
interface AXPActivityCategory extends AXPCategoryEntity {
}
/**
 * Activity Definition - Metadata for UI and tooling.
 * Contains all metadata needed for displaying activities in toolbox and designer.
 * The `name` property is used as the command key for execution.
 */
interface AXPActivityDefinition {
    /**
     * Activity name - used as command key for execution.
     * This is the unique identifier for the activity.
     */
    name: string;
    /**
     * Activity type (e.g., "workflow-activity:check-permission").
     */
    type: string;
    /**
     * Display name for UI.
     */
    title?: string;
    /**
     * Description of what the activity does.
     */
    description?: string;
    /**
     * Category for grouping in toolbox.
     */
    category?: string;
    /**
     * Icon name or class.
     */
    icon?: string;
    /**
     * Where this activity should be executed.
     * - 'frontend': Execute in browser (UI activities, console, events)
     * - 'backend': Execute in backend (business logic, API calls)
     * - 'both': Execute in both frontend and backend (hybrid activities)
     *
     * Default: 'frontend'
     */
    executionMode?: 'frontend' | 'backend' | 'both';
    /**
     * Type of task for inbox handling.
     * - 'human-task': Requires inbox - needs human interaction
     * - 'ui-activity': UI-only activity (no inbox) - immediate execution
     * - 'system-activity': System/backend activity (no inbox) - automated execution
     *
     * Default: 'ui-activity' (for backward compatibility)
     */
    taskType?: AXPTaskType;
    /**
     * Input descriptors.
     */
    inputs?: AXPWorkflowInputDescriptor[];
    /**
     * Output descriptors.
     */
    outputs?: AXPWorkflowOutputDescriptor[];
    /**
     * Static outcomes (exit points).
     * Example: ['Done', 'Success', 'Failed']
     */
    outcomes?: string[];
    /**
     * Whether this activity is browsable in the toolbox.
     * Default: true
     */
    isBrowsable?: boolean;
    /**
     * Whether this activity is a container (can have children).
     * Default: false
     */
    isContainer?: boolean;
}
/**
 * Activity - Command with specific TResult structure.
 * Extends AXPCommand with a fixed TResult that includes output and outcomes.
 * No additional properties beyond AXPCommand - pure command interface.
 */
interface AXPActivity<TInput = any, TOutput = any> extends AXPCommand<TInput, {
    output: TOutput;
    outcomes: Record<string, any>;
}> {
    /**
     * Execute the activity as a command.
     * @param input - Activity input data
     * @returns Promise with output and outcomes
     */
    execute(input: TInput): AXPExecuteCommandResultPromise<{
        output: TOutput;
        outcomes: Record<string, any>;
    }>;
}

type AXPActivityProviderToken = AXPActivityProvider | Promise<AXPActivityProvider>;
declare const AXP_ACTIVITY_PROVIDER: InjectionToken<AXPActivityProviderToken[]>;
interface AXPActivityProvider {
    /**
     * Get list of activity definitions for a category.
     * @param categoryId - Category ID to filter activities
     * @returns Promise of activity definitions array
     */
    getList(categoryId: string): Promise<AXPActivityDefinition[]>;
    /**
     * Get activity definition by name (unique identifier).
     * The name is used as the command key for execution.
     * @param name - Activity name (unique identifier and command key)
     * @returns Promise of activity definition or undefined if not found
     */
    getById(name: string): Promise<AXPActivityDefinition | undefined>;
}
type AXPActivityCategoryProviderToken = AXPActivityCategoryProvider | Promise<AXPActivityCategoryProvider>;
declare const AXP_ACTIVITY_CATEGORY_PROVIDER: InjectionToken<AXPActivityCategoryProviderToken[]>;
interface AXPActivityCategoryProvider {
    getList(parentId?: string): Promise<AXPActivityCategory[]>;
    getById(id: string): Promise<AXPActivityCategory | undefined>;
}

/**
 * Optimized Activity Definition Service
 *
 * Manages activity definitions (metadata) for UI and tooling.
 * Similar to AXPReportDefinitionService - only handles metadata, not execution.
 *
 * Performance optimizations:
 * 1. Uses childrenCount to determine if category has children (no query needed)
 * 2. Uses itemsCount to determine if category has activities (no query needed)
 * 3. Aggressive caching prevents duplicate API calls
 * 4. Single pending request per resource prevents race conditions
 * 5. Lazy loading - only loads data when needed
 */
declare class AXPActivityDefinitionService {
    private readonly categoryProviders;
    private readonly activityProviders;
    /** Cache for categories by id - O(1) lookup */
    private categoriesById;
    /** Cache for categories by parentId - O(1) lookup */
    private categoriesByParentId;
    /** Cache for activity definitions by categoryId - O(1) lookup */
    private activitiesByCategory;
    /** Cache for individual activity definitions by name - O(1) lookup */
    private activitiesByName;
    /** Track which provider index owns each category (by category ID) */
    private categoryOwnership;
    /** Pending API requests to prevent duplicate calls */
    private pendingCategoriesRequests;
    private pendingActivitiesRequests;
    private pendingActivityRequests;
    /**
     * Get categories by parentId with aggressive caching
     *
     * Optimization: Returns cached result immediately if available,
     * preventing unnecessary API calls during navigation
     *
     * @param parentId - Parent category ID (undefined = root categories)
     * @returns Array of categories with count metadata (childrenCount, itemsCount)
     */
    getCategories(parentId?: string): Promise<AXPActivityCategory[]>;
    /**
     * Get single category by ID with O(1) lookup
     *
     * Optimization: Uses Map for instant retrieval, falls back to
     * searching cache, then providers if not found
     */
    getCategoryById(categoryId: string): Promise<AXPActivityCategory | undefined>;
    /**
     * Get category path from root to specified category
     *
     * Optimization: Builds path using cached categories only
     */
    getCategoriesPathById(categoryId: string): Promise<AXPActivityCategory[]>;
    /**
     * Get activity definitions for a category with smart caching
     *
     * Optimization: Checks itemsCount before querying
     * - If itemsCount = 0, returns empty array (no API call)
     * - If itemsCount > 0, loads and caches activity definitions
     * - Returns cached result on subsequent calls
     *
     * @param categoryId - Category ID to get activity definitions from
     * @returns Array of activity definitions
     */
    getActivitiesByCategoryId(categoryId: string): Promise<AXPActivityDefinition[]>;
    /**
     * Get single activity definition by name with O(1) lookup
     *
     * Optimization: Uses Map for instant retrieval
     *
     * @param name - Activity name (unique identifier and command key)
     * @returns Activity definition or undefined if not found
     */
    getActivityByName(name: string): Promise<AXPActivityDefinition | undefined>;
    /**
     * Get category ID containing a specific activity definition
     *
     * Optimization: Searches cache first, loads on-demand if needed
     */
    getCategoryIdByActivityName(activityName: string): Promise<string | undefined>;
    /**
     * Get category path for an activity
     */
    getCategoriesPathByActivityName(activityName: string): Promise<AXPActivityCategory[]>;
    /**
     * Load categories from providers and cache results
     *
     * Optimization: Tracks provider ownership to avoid unnecessary API calls
     * - For root (parentId = undefined): Query ALL providers
     * - For children: Only query the provider that owns the parent
     */
    private loadCategoriesFromProviders;
    /**
     * Get the provider index that owns a specific category
     *
     * @returns Array with provider index, or null if ownership unknown (query all)
     */
    private getProviderIndexForCategory;
    /**
     * Load activity definitions from providers and cache results
     *
     * Optimization: Only queries the provider that owns the category
     * Uses provider INDEX to match category provider with activity provider
     */
    private loadActivitiesFromProviders;
    /**
     * Load single activity definition from providers and cache result
     */
    private loadActivityFromProviders;
    /**
     * Breadth-first search through category hierarchy
     */
    private searchCategoryInHierarchy;
    /**
     * Check if category has children (uses cached count)
     */
    categoryHasChildren(categoryId: string): boolean;
    /**
     * Check if category has activities (uses cached count)
     */
    categoryHasActivities(categoryId: string): boolean;
    /**
     * Clear all caches
     */
    clearAllCache(): void;
    /**
     * Clear categories cache only
     */
    clearCategoriesCache(): void;
    /**
     * Clear activities cache only
     */
    clearActivitiesCache(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPActivityDefinitionService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPActivityDefinitionService>;
}

/**
 * Represents a workflow task that needs to be executed.
 * Inspired by Temporal's Activity Tasks and Camunda's External Tasks.
 */
interface AXPWorkflowTask {
    /**
     * Unique token for this task (used for completion/security).
     */
    taskToken: string;
    /**
     * Activity ID from workflow definition.
     */
    activityId: string;
    /**
     * Activity type (e.g., 'workflow-activity:show-toast').
     */
    activityType: string;
    /**
     * Human-readable activity name.
     */
    activityName?: string;
    /**
     * Where this task should be executed.
     * - 'frontend': Execute in browser (UI activities, console, events)
     * - 'backend': Execute in backend (business logic, API calls)
     * - 'both': Execute in both frontend and backend (hybrid activities)
     */
    executionMode: 'frontend' | 'backend' | 'both';
    /**
     * Type of task for inbox handling.
     */
    taskType?: 'human-task' | 'ui-activity' | 'system-activity';
    /**
     * Input data for the activity (for frontend activities).
     */
    input?: Record<string, any>;
    /**
     * Configuration for the activity (for frontend activities).
     */
    config?: Record<string, any>;
}
/**
 * Request to start a workflow instance.
 */
interface AXPStartWorkflowRequest {
    /**
     * Workflow ID to execute.
     */
    workflowId: string;
    /**
     * Initial input data for workflow.
     */
    input: Record<string, any>;
}
/**
 * Response after starting workflow instance.
 */
interface AXPStartWorkflowResponse {
    /**
     * Unique instance ID for this workflow run.
     */
    instanceId: string;
    /**
     * Current workflow state.
     */
    state: AXPWorkflowInstanceState;
    /**
     * First task to execute (determined by backend).
     * Client should execute this task based on executionMode.
     */
    pendingTask?: AXPWorkflowTask | null;
    /**
     * Activity outputs map (activityId -> output).
     * Returned for expression evaluation in subsequent activities.
     */
    activityOutputs?: Record<string, any>;
    /**
     * Last activity output (convenience).
     * Prefer using `activityOutputs[activityId]` when possible.
     */
    lastActivityOutput?: any;
}
/**
 * Request to resume a suspended workflow.
 */
interface AXPResumeWorkflowRequest {
    /**
     * Instance ID.
     */
    instanceId: string;
    /**
     * Step ID that was waiting for user input.
     */
    stepId: string;
    /**
     * Secure task token issued with the pending task.
     * Backend validates and resolves the step using this token.
     */
    taskToken: string;
    /**
     * User action outcome (e.g., 'Confirmed', 'Cancelled').
     */
    outcome: string;
    /**
     * Optional user input data.
     */
    userInput?: any;
}
/**
 * Response after resuming workflow.
 */
interface AXPResumeWorkflowResponse {
    /**
     * Activity execution output.
     */
    output: any;
    /**
     * Activity execution outcomes.
     */
    outcomes: Record<string, any>;
    /**
     * Next task to execute (if any).
     */
    nextTask?: AXPWorkflowTask | null;
    /**
     * Updated workflow state.
     */
    state: AXPWorkflowInstanceState;
}
/**
 * Request to get workflow instance state.
 */
interface AXPGetWorkflowStateRequest {
    /**
     * Instance ID.
     */
    instanceId: string;
}
/**
 * Workflow instance state (managed by backend, cached in client).
 */
interface AXPWorkflowInstanceState {
    /**
     * Unique instance ID.
     */
    instanceId: string;
    /**
     * Workflow ID.
     */
    workflowId: string;
    /**
     * Current instance status.
     */
    status: 'running' | 'completed' | 'suspended' | 'error';
    /**
     * Current step ID (if suspended or running).
     */
    currentStepId?: string;
    /**
     * Workflow variables (state).
     */
    variables: Record<string, any>;
    /**
     * Activity outputs map (activityId -> output).
     * Used by expression evaluation scope as `outputs.activityId`.
     */
    activityOutputs?: Record<string, any>;
    /**
     * Last activity output (convenience).
     * Useful when the next activity needs a quick access to the previous result.
     */
    lastActivityOutput?: any;
    /**
     * Initial input data.
     */
    input: Record<string, any>;
    /**
     * Final output data (if completed).
     */
    output?: Record<string, any>;
    /**
     * Last update timestamp.
     */
    lastUpdated: Date;
}
interface AXPFrontActivityCompleteRequest {
    /**
     * Instance ID.
     */
    instanceId: string;
    activityNode: string;
    output: Record<string, any>;
    outcome: string;
}
interface AXPFrontActivityCompleteResponse {
    /**
     * Activity execution output.
     */
    output?: any;
    /**
     * Activity execution outcomes.
     */
    outcomes?: Record<string, any>;
    /**
     * Next task to execute (if any).
     */
    nextTask?: AXPWorkflowTask | null;
    /**
     * Updated workflow state.
     */
    state?: AXPWorkflowInstanceState;
}

/**
 * Interface for workflow engine operations.
 */
interface AXPWorkflowEngine {
    /**
     * Start a new workflow instance.
     *
     * Creates a new workflow instance in backend and returns instance ID.
     *
     * @param request - Start workflow request
     * @returns Response with instanceId and initial state
     *
     */
    start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
    /**
     * Resume a suspended workflow instance.
     *
     * Resumes workflow instance after user interaction (e.g., after show-dialog).
     *
     * @param request - Resume workflow request
     * @returns Resume response with next step and updated state
     *
     */
    resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
    /**
     * Get current workflow instance state.
     *
     * Retrieves current state of a workflow instance from backend.
     *
     * @param request - Get state request
     * @returns Current workflow instance state
     *
     */
    getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
    frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;
}
/**
 * Injection token for workflow engine.
 * Default implementation is AXPWorkflowLocalEngine.
 */
declare const AXP_WORKFLOW_ENGINE: InjectionToken<AXPWorkflowEngine>;

/**
 * Result of starting a workflow.
 */
interface WorkflowStartResult {
    /**
     * Whether the operation succeeded.
     */
    success: boolean;
    /**
     * Workflow instance ID.
     */
    instanceId?: string;
    /**
     * Initial workflow state.
     */
    state?: AXPWorkflowInstanceState;
    /**
     * First task to execute (if any).
     */
    nextTask?: AXPWorkflowTask | null;
    /**
     * Workflow output (if completed immediately).
     */
    output?: any;
    /**
     * Error message (if failed).
     */
    error?: string;
}
/**
 * Result of completing a task.
 */
interface WorkflowCompleteResult {
    /**
     * Whether the operation succeeded.
     */
    success: boolean;
    /**
     * Workflow instance ID.
     */
    instanceId: string;
    /**
     * Updated workflow state.
     */
    state?: AXPWorkflowInstanceState;
    /**
     * Next task to execute (if any).
     */
    nextTask?: AXPWorkflowTask | null;
    /**
     * Workflow output (if completed).
     */
    output?: any;
    /**
     * Error message (if failed).
     */
    error?: string;
}
/**
 * Result of resuming a workflow.
 */
interface WorkflowResumeResult {
    /**
     * Whether the operation succeeded.
     */
    success: boolean;
    /**
     * Workflow instance ID.
     */
    instanceId: string;
    /**
     * Updated workflow state.
     */
    state?: AXPWorkflowInstanceState;
    /**
     * Next task to execute (if any).
     */
    nextTask?: AXPWorkflowTask | null;
    /**
     * Workflow output (if completed).
     */
    output?: any;
    /**
     * Error message (if failed).
     */
    error?: string;
}
/**
 * Workflow Manager - Facade for workflow lifecycle orchestration.
 *
 * This service is the ONLY interface the frontend uses to interact with workflows.
 * It follows Clean Architecture principles and does NOT contain execution or business logic.
 *
 * Responsibilities:
 * - Orchestrate workflow lifecycle (start, execute, complete, resume)
 * - Delegate execution to ActivityExecutor
 * - Cache workflow state in memory
 * - Expose a stable API for UI
 *
 * Rules:
 * - No HTTP calls (delegates to AXPWorkflowEngine)
 * - No CommandBus / Command execution (delegates to ActivityExecutor)
 * - No workflow branching logic (backend decides)
 * - No business validation (backend validates)
 * - No backend assumptions (uses abstract runtime service)
 */
declare class AXPWorkflowManager {
    private readonly workflowEngine;
    private readonly activityExecutor;
    /**
     * Cache workflow states in memory for quick access.
     * Key: instanceId
     * Value: AXPWorkflowInstanceState
     */
    private stateCache;
    /**
     * Cache TTL in milliseconds (5 minutes).
     */
    private readonly CACHE_TTL;
    /**
     * Execute frontend activities interactively until reaching human-task or completion.
     *
     * This method handles the interactive flow between frontend and backend:
     * 1. Executes frontend activity (ui-activity)
     * 2. Sends result to backend via frontActivtyComplete
     * 3. If backend returns nextTask (frontend activity), repeats the process
     * 4. Continues until workflow completes or reaches human-task
     *
     * @param instanceId - Workflow instance ID
     * @param task - Current task to execute
     * @param state - Current workflow state
     * @param lastActivityOutput - Last activity output (for expression evaluation)
     * @returns Final result with nextTask (if human-task) or completion status
     */
    private executeInteractiveFlow;
    /**
     * Start a new workflow instance.
     *
     * Creates a new workflow instance in backend and returns instance ID.
     * Backend decides what to do: returns pendingTask or indicates completion.
     *
     * @param workflowId - Workflow ID to start
     * @param input - Initial input data (optional)
     * @returns Start result with instanceId, state, and nextTask
     *
     * @example
     * ```typescript
     * const result = await workflowManager.start('my-workflow', { userId: '123' });
     *
     * if (result.success && result.nextTask) {
     *   // Execute task if frontend
     *   if (result.nextTask.executionMode === 'frontend') {
     *     const execResult = await workflowManager.execute(result.nextTask);
     *     await workflowManager.complete(result.instanceId!, result.nextTask, execResult.outcome, execResult.output);
     *   }
     * }
     * ```
     */
    start(workflowId: string, input?: Record<string, any>): Promise<WorkflowStartResult>;
    /**
     * Resume a suspended workflow (e.g., after user interaction).
     *
     * Backend determines nextStep based on outcome and outcomeConnections.
     * Client only provides instanceId, stepId, outcome, and optional userInput.
     *
     * @param instanceId - Workflow instance ID
     * @param stepId - Step ID that was waiting for user input
     * @param outcome - User action outcome (e.g., 'Confirmed', 'Cancelled', 'Submitted')
     * @param userInput - Optional user input data
     * @param taskToken - Secure task token (required for secure resumption)
     * @returns Resume result with next task (if any)
     */
    resume(instanceId: string, stepId: string, outcome: string, userInput?: any, taskToken?: string): Promise<WorkflowResumeResult>;
    /**
     * Get workflow instance state.
     *
     * Retrieves state from cache (if valid) or from backend.
     *
     * @param instanceId - Workflow instance ID
     * @returns Workflow instance state or null if not found
     */
    getState(instanceId: string): Promise<AXPWorkflowInstanceState | null>;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowManager, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowManager>;
}

/**
 * Local engine implementation that manages workflow progression and state.
 *
 * This engine:
 * - Returns frontend/both activities as pendingTask (does NOT execute them)
 * - Skips backend activities (does not error, continues execution)
 * - Maintains workflow state in memory
 * - Does not require backend API calls
 *
 * Execution of frontend tasks is handled by AXPWorkflowManager via ActivityExecutor.
 * This engine only manages workflow progression and state storage.
 *
 * This is the DEFAULT engine provider. Applications can override it with
 * an API-based engine implementation.
 */
declare class AXPWorkflowLocalEngine implements AXPWorkflowEngine {
    private readonly activityDefinitionService;
    private readonly workflowProviders;
    /**
     * In-memory storage for workflow instances.
     * Key: instanceId
     * Value: LocalWorkflowState
     */
    private instances;
    /**
     * Task token storage for secure resume operations.
     * Key: taskToken
     * Value: { instanceId, activityId }
     */
    private taskTokens;
    /**
     * Start a new workflow instance.
     *
     * Creates an in-memory workflow instance and progresses it.
     * Frontend/both activities are returned as pendingTask for external execution.
     * Backend activities are skipped.
     */
    start(request: AXPStartWorkflowRequest): Promise<AXPStartWorkflowResponse>;
    /**
     * Resume a suspended workflow instance.
     *
     * Validates task token, applies externally executed result,
     * and continues progressing workflow steps.
     */
    resume(request: AXPResumeWorkflowRequest): Promise<AXPResumeWorkflowResponse>;
    /**
     * Get current workflow instance state.
     */
    getState(request: AXPGetWorkflowStateRequest): Promise<AXPWorkflowInstanceState>;
    /**
     * Get workflow definition from available providers.
     */
    private getDefinition;
    /**
     * Progress workflow steps starting from the current position.
     *
     * For frontend/both activities: returns task immediately (suspends workflow).
     * For backend activities: skips and continues.
     *
     * Returns the next pending task (if frontend activity found) or null (if completed).
     */
    private executeWorkflowSteps;
    /**
     * Get next activity ID based on connections and outcomes.
     */
    private getNextActivityId;
    frontActivtyComplete(request: AXPFrontActivityCompleteRequest): Promise<AXPFrontActivityCompleteResponse>;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowLocalEngine, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowLocalEngine>;
}

/**
 * Result of executing a workflow activity.
 */
interface ActivityExecutionResult {
    /**
     * Activity execution output.
     */
    output: any;
    /**
     * Activity execution outcome (e.g., 'Done', 'Confirmed', 'Cancelled', 'Failed').
     */
    outcome: string;
}
/**
 * Activity Executor Service
 *
 * Service for executing workflow activities via CommandBus.
 * Automatically evaluates expressions in activity inputs before execution.
 *
 * @example
 * ```typescript
 * const executor = inject(ActivityExecutor);
 *
 * // Execute activity with task and workflow state (expressions will be evaluated)
 * const result = await executor.execute(task, workflowState, activityOutputs);
 * ```
 */
declare class ActivityExecutor {
    private readonly commandService;
    private readonly expressionEvaluator;
    private readonly expressionScopeService;
    /**
     * Execute a workflow activity with expression evaluation.
     *
     * Evaluates expressions in activity inputs using workflow state,
     * then executes the activity via CommandBus.
     *
     * @param task - Workflow task containing activity information
     * @param workflowState - Current workflow instance state (for expression evaluation)
     * @param activityOutputs - Map of previous activity outputs (for expression evaluation)
     * @returns Execution result with output and outcome
     */
    execute(task: AXPWorkflowTask, workflowState?: AXPWorkflowInstanceState, activityOutputs?: Map<string, any> | Record<string, any>): Promise<ActivityExecutionResult>;
    static ɵfac: i0.ɵɵFactoryDeclaration<ActivityExecutor, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ActivityExecutor>;
}

/**
 * Workflow expression evaluation context.
 * Contains workflow state data needed for expression evaluation.
 */
interface WorkflowExpressionContext {
    /** Workflow input values */
    inputs: Record<string, any>;
    /** Workflow state variables */
    variables: Record<string, any>;
    /** Previous activity outputs (activityId -> output) */
    outputs: Record<string, any>;
}
/**
 * Workflow Expression Scope Service
 *
 * Shared service for building expression evaluation scope from workflow data.
 * Used by both Local Engine and Mock Runtime to manage workflow data (inputs, variables, outputs).
 *
 * Responsibilities:
 * - Build expression evaluation scope from workflow state
 * - Provide context.eval() function for accessing workflow data
 * - Manage workflow data structure (inputs, variables, outputs)
 *
 * This service does NOT:
 * - Execute activities
 * - Evaluate expressions (delegates to AXPExpressionEvaluatorService)
 * - Manage workflow state (handled by runtime)
 *
 * @example
 * ```typescript
 * const scopeService = inject(WorkflowExpressionScopeService);
 *
 * // Build scope from workflow state
 * const scope = scopeService.buildScope({
 *   inputs: state.input || {},
 *   variables: state.variables || {},
 *   outputs: activityOutputs
 * });
 *
 * // Or build from state directly
 * const scope = scopeService.buildScopeFromState(state, activityOutputs);
 * ```
 */
declare class WorkflowExpressionScopeService {
    /**
     * Build expression evaluation scope for workflow activities.
     *
     * Provides workflow-specific data (inputs, variables, outputs) and context.eval() function.
     * Other data (session, current user, etc.) are provided by expression evaluator scope providers.
     *
     * Scope includes:
     * - inputs: Workflow input values (accessible as inputs.propertyName)
     * - variables: Workflow state variables (accessible as variables.propertyName or vars.propertyName)
     * - outputs: Previous activity outputs (accessible as outputs.activityId)
     * - context.eval(path): Function to access nested properties from workflow data
     *
     * Expressions can use:
     * - {{inputs.userName}} - Direct access to workflow input
     * - {{variables.someVar}} or {{vars.someVar}} - Direct access to workflow variable
     * - {{outputs.activityId.property}} - Direct access to previous activity output
     * - {{context.eval("inputs.userName")}} - Access via context.eval (supports nested paths)
     * - {{context.eval("variables.someVar")}} - Access variables via context.eval
     * - {{context.eval("outputs.activityId.property")}} - Access outputs via context.eval
     * - {{session.currentUser().name}} - Access current user via expression evaluator scope providers
     *
     * The context.eval() function provides a unified way to access all workflow data,
     * similar to how entity-detail-list uses context.eval() to access parent data.
     *
     * @param context - Workflow expression context containing inputs, variables, and outputs
     * @returns Expression evaluator scope with workflow data and context.eval() function
     */
    buildScope(context: WorkflowExpressionContext): AXPExpressionEvaluatorScope;
    /**
     * Build expression evaluation scope from workflow instance state.
     *
     * Convenience method that extracts data from AXPWorkflowInstanceState.
     *
     * @param state - Workflow instance state
     * @param activityOutputs - Map of activity outputs (activityId -> output)
     * @returns Expression evaluator scope with workflow data and context.eval() function
     */
    buildScopeFromState(state: AXPWorkflowInstanceState, activityOutputs?: Map<string, any> | Record<string, any>): AXPExpressionEvaluatorScope;
    static ɵfac: i0.ɵɵFactoryDeclaration<WorkflowExpressionScopeService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<WorkflowExpressionScopeService>;
}

/**
 * Workflow Category - Extends AXPCategoryEntity for consistency and performance
 *
 * Inherited properties from AXPCategoryEntity:
 * - id: string                   - Unique identifier
 * - title: string                - Display name
 * - description?: string         - Category description
 * - parentId?: string            - Parent category ID
 * - childrenCount: number        - Direct child categories count (enables lazy loading)
 * - itemsCount?: number          - Direct workflows count
 * - totalChildrenCount?: number  - Total nested categories (optional, for analytics)
 * - totalItemsCount?: number     - Total workflows in tree (optional, for analytics)
 */
interface AXPWorkflowCategory extends AXPCategoryEntity {
}
type AXPWorkflowProviderToken = AXPWorkflowProvider | Promise<AXPWorkflowProvider>;
declare const AXP_WORKFLOW_PROVIDER: InjectionToken<AXPWorkflowProviderToken[]>;
interface AXPWorkflowProvider {
    /**
     * Get list of workflow definitions for a category.
     * @param categoryId - Category ID to filter workflows
     * @returns Promise of workflow definition array
     */
    getList(categoryId: string): Promise<AXPWorkflowDefinition[]>;
    /**
     * Get full workflow definition by name (unique identifier).
     * Used by workflow engines for execution and UI for metadata.
     * @param name - Workflow name (unique identifier)
     * @returns Promise of full workflow definition or null if not found
     */
    getByName(name: string): Promise<AXPWorkflowDefinition | null>;
}
type AXPWorkflowCategoryProviderToken = AXPWorkflowCategoryProvider | Promise<AXPWorkflowCategoryProvider>;
declare const AXP_WORKFLOW_CATEGORY_PROVIDER: InjectionToken<AXPWorkflowCategoryProviderToken[]>;
interface AXPWorkflowCategoryProvider {
    getList(parentId?: string): Promise<AXPWorkflowCategory[]>;
    getById(id: string): Promise<AXPWorkflowCategory | undefined>;
}

/**
 * Optimized Workflow Definition Service
 *
 * Manages workflow definitions (metadata) for UI and tooling.
 * Similar to AXPActivityDefinitionService - only handles metadata, not execution.
 *
 * Performance optimizations:
 * 1. Uses childrenCount to determine if category has children (no query needed)
 * 2. Uses itemsCount to determine if category has workflows (no query needed)
 * 3. Aggressive caching prevents duplicate API calls
 * 4. Single pending request per resource prevents race conditions
 * 5. Lazy loading - only loads data when needed
 */
declare class AXPWorkflowDefinitionService {
    private readonly categoryProviders;
    private readonly workflowProviders;
    /** Cache for categories by id - O(1) lookup */
    private categoriesById;
    /** Cache for categories by parentId - O(1) lookup */
    private categoriesByParentId;
    /** Cache for workflow definitions by categoryId - O(1) lookup */
    private workflowsByCategory;
    /** Cache for individual workflow definitions by name - O(1) lookup */
    private workflowsByName;
    /** Track which provider index owns each category (by category ID) */
    private categoryOwnership;
    /** Pending API requests to prevent duplicate calls */
    private pendingCategoriesRequests;
    private pendingWorkflowsRequests;
    private pendingWorkflowRequests;
    /**
     * Get categories by parentId with aggressive caching
     *
     * Optimization: Returns cached result immediately if available,
     * preventing unnecessary API calls during navigation
     *
     * @param parentId - Parent category ID (undefined = root categories)
     * @returns Array of categories with count metadata (childrenCount, itemsCount)
     */
    getCategories(parentId?: string): Promise<AXPWorkflowCategory[]>;
    /**
     * Get single category by ID with O(1) lookup
     *
     * Optimization: Uses Map for instant retrieval, falls back to
     * searching cache, then providers if not found
     */
    getCategoryById(categoryId: string): Promise<AXPWorkflowCategory | undefined>;
    /**
     * Get category path from root to specified category
     *
     * Optimization: Builds path using cached categories only
     */
    getCategoriesPathById(categoryId: string): Promise<AXPWorkflowCategory[]>;
    /**
     * Get workflow definitions for a category with smart caching
     *
     * Optimization: Checks itemsCount before querying
     * - If itemsCount = 0, returns empty array (no API call)
     * - If itemsCount > 0, loads and caches workflow definitions
     * - Returns cached result on subsequent calls
     *
     * @param categoryId - Category ID to get workflow definitions from
     * @returns Array of workflow definitions
     */
    getWorkflowsByCategoryId(categoryId: string): Promise<AXPWorkflowDefinition[]>;
    /**
     * Get single workflow definition by name with O(1) lookup
     *
     * Optimization: Uses Map for instant retrieval
     *
     * @param name - Workflow name (unique identifier)
     * @returns Workflow definition or undefined if not found
     */
    getWorkflowByName(name: string): Promise<AXPWorkflowDefinition | undefined>;
    /**
     * Get category ID containing a specific workflow definition
     *
     * Optimization: Searches cache first, loads on-demand if needed
     */
    getCategoryIdByWorkflowName(workflowName: string): Promise<string | undefined>;
    /**
     * Get category path for a workflow
     */
    getCategoriesPathByWorkflowName(workflowName: string): Promise<AXPWorkflowCategory[]>;
    /**
     * Load categories from providers and cache results
     *
     * Optimization: Tracks provider ownership to avoid unnecessary API calls
     * - For root (parentId = undefined): Query ALL providers
     * - For children: Only query the provider that owns the parent
     */
    private loadCategoriesFromProviders;
    /**
     * Get the provider index that owns a specific category
     *
     * @returns Array with provider index, or null if ownership unknown (query all)
     */
    private getProviderIndexForCategory;
    /**
     * Load workflow definitions from providers and cache results
     *
     * Optimization: Only queries the provider that owns the category
     * Uses provider INDEX to match category provider with workflow provider
     */
    private loadWorkflowsFromProviders;
    /**
     * Load single workflow definition from providers and cache result
     */
    private loadWorkflowFromProviders;
    /**
     * Breadth-first search through category hierarchy
     */
    private searchCategoryInHierarchy;
    /**
     * Check if category has children (uses cached count)
     */
    categoryHasChildren(categoryId: string): boolean;
    /**
     * Check if category has workflows (uses cached count)
     */
    categoryHasWorkflows(categoryId: string): boolean;
    /**
     * Clear all caches
     */
    clearAllCache(): void;
    /**
     * Clear categories cache only
     */
    clearCategoriesCache(): void;
    /**
     * Clear workflows cache only
     */
    clearWorkflowsCache(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<AXPWorkflowDefinitionService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AXPWorkflowDefinitionService>;
}

export { AXPActivityDefinitionService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionService, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowFunction, AXPWorkflowLocalEngine, AXPWorkflowManager, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_CATEGORY_PROVIDER, AXP_WORKFLOW_ENGINE, AXP_WORKFLOW_PROVIDER, ActivityExecutor, WorkflowExpressionScopeService, createWorkFlowEvent, ofType };
export type { AXPActivity, AXPActivityCategory, AXPActivityCategoryProvider, AXPActivityCategoryProviderToken, AXPActivityDefinition, AXPActivityExecutionContextState, AXPActivityIncident, AXPActivityProvider, AXPActivityProviderToken, AXPActivityStatus, AXPActivityVariable, AXPBookmark, AXPCompletionCallbackState, AXPConnection, AXPElsaWorkflowExtensions, AXPExceptionState, AXPFrontActivityCompleteRequest, AXPFrontActivityCompleteResponse, AXPGetWorkflowStateRequest, AXPResumeWorkflowRequest, AXPResumeWorkflowResponse, AXPStartWorkflowRequest, AXPStartWorkflowResponse, AXPTaskType, AXPVariableDefinition, AXPWorkflow, AXPWorkflowActionInput, AXPWorkflowActivityInstance, AXPWorkflowBinding, AXPWorkflowCategory, AXPWorkflowCategoryProvider, AXPWorkflowCategoryProviderToken, AXPWorkflowCondition, AXPWorkflowConditionType, AXPWorkflowDefinition, AXPWorkflowEngine, AXPWorkflowEvent, AXPWorkflowExtensions, AXPWorkflowFaultState, AXPWorkflowGraph, AXPWorkflowInputDescriptor, AXPWorkflowInstance, AXPWorkflowInstanceState, AXPWorkflowModuleConfigs, AXPWorkflowNextStep, AXPWorkflowOutputDescriptor, AXPWorkflowProvider, AXPWorkflowProviderToken, AXPWorkflowState, AXPWorkflowStatus, AXPWorkflowStep, AXPWorkflowSubStatus, AXPWorkflowTask, ActivityExecutionResult, WorkflowCompleteResult, WorkflowExpressionContext, WorkflowResumeResult, WorkflowStartResult };
