import { Task } from "./Task";
/** Shorthand for a deferrable result. */
export declare type Deferrable<T> = PromiseLike<T> | T;
/** Implemented by activity handlers. */
export interface IActivityHandler {
    /** Executes the logic for an activity. */
    execute(inputs: {}, context: IActivityContext, ...args: any[]): Deferrable<{}>;
}
/** Describes ambient-level state. */
export interface IAmbientState {
    /** Indicates the ActivityContexts with group name monikers that are in scope. */
    activityContexts: {};
    /** Indicates the completion object. */
    completion: Task<{}>;
    /** Indicates the environment for expressions evaluation. */
    environment: {};
    /** Indicates the resources for expression evaluation. */
    resources: {};
    /** Indicates the error given to the workflow consumer. */
    error: Error;
    /** Indicates the inputs given to the workflow consumer. */
    inputs: {};
    /** Indicates the current workflow locale */
    locale: string;
    /** Indicates the outputs that the workflow should return. */
    outputs: {};
    /** Indicates the trivia for storing ambient-level state. */
    trivia: {};
    /** Immediately completes the workflow. */
    complete(outputs?: {}): void;
    /** Immediately completes the workflow with an error. */
    reject(error?: Error): void;
}
/**
 * Describes something that can be aborted via an `AbortController`.
 */
export interface Abortable {
    /**
     * An `AbortSignal` to be passed to Esri's web-based APIs.
     * When aborted, the operation will be cancelled.
     */
    signal?: AbortSignal;
}
/** Describes an activity currently being executed. */
export interface IActivityContext {
    /** Indicates the locally-unique identifier that changes per-run per-activity. */
    luid: any;
    /** Indicates the ambient state. */
    ambient: IAmbientState;
    /** Indicates the action being executed. */
    action: string;
    /** Indicates the branch being executed. */
    branch: boolean | number | string;
    /** Indicates the cancellation token. */
    cancellationToken: Task<void> & Abortable;
    /** Indicates the number of passes on the current step. */
    passes: number;
    /** Indicates the state that was persisted. */
    state: any;
    /** Indicates the error that was caught. */
    caught: Error;
    /** Attempts to call on a transition chain. */
    call(branch?: boolean | number | string): void;
    /** Attempts to fork to a transition chain. */
    fork(branch?: boolean | number | string): void;
    /** Attempts to jump to a transition chain. */
    jump(branch?: boolean | number | string): void;
    /** Instructs the engine to allow the activity to handle errors. */
    registerForErrors(): void;
    /** Indicates if any transitions are available for the given branch. */
    hasBranch(branch?: boolean | number | string): boolean;
    /** Persists state across invocations. */
    persist(state: any): void;
    /** Attempts to restart the workflow at the context. */
    goto(): void;
}
/**
 * Indicates an activity has no inputs. Should only be used in
 * an activity's execute method signature.
 */
export interface EmptyInputs {
}
/**
 * Indicates an activity has no outputs. Should only be used in
 * an activity's execute method signature.
 */
export interface EmptyOutputs {
}
