import { Observable } from 'rxjs';
import { TaskManager } from './definitions';
import { TaskErrorResolutionServiceInterface } from './provider';
import * as i0 from "@angular/core";
declare type TaskContainer<TaskContext, TaskResult> = TaskManager.TaskContainer<TaskContext, TaskResult>;
export declare function randomId(): string;
export declare class TaskManagerService {
    private taskErrorResolutionService;
    private _tasks;
    private _events;
    get events(): Observable<TaskManager.Event<unknown, unknown>>;
    get tasks(): TaskManager.Task<unknown>[];
    constructor(taskErrorResolutionService: TaskErrorResolutionServiceInterface);
    createTask<TaskContext, TaskResult = unknown>(task: TaskManager.Task<TaskContext, TaskResult>, options?: {
        position?: number;
    }): TaskManager.TaskContainer<TaskContext, TaskResult>;
    removeTask(id: string): void;
    hasTask(id: string): boolean;
    task<TaskContext>(id: string): TaskManager.Task<TaskContext> | undefined;
    container<TaskContext, TaskResult = unknown>(id: string): TaskContainer<TaskContext, TaskResult> | undefined;
    cancel(id: string): void;
    taskMeta(id: string): {
        state: TaskManager.TaskState;
        result?: unknown;
        error?: Error | undefined;
        context?: any;
    } | undefined;
    addTaskContainer<TaskContext>(container: TaskManager.TaskContainer<TaskContext>): void;
    addTask$<TaskContext>(task: TaskManager.Task<TaskContext>, options?: {
        position?: number;
    }): Observable<TaskManager.Event<TaskContext>>;
    clearTask(id: string): void;
    cancelAll(): void;
    clearAll(): void;
    exec<TaskContext>(taskId: string, context: TaskContext): Observable<TaskManager.Event<TaskContext>>;
    private execAsObservable;
    retry<TaskContext, TaskResult>(container: TaskManager.TaskContainer<TaskContext, TaskResult>): Promise<TaskResult>;
    execNext(): Observable<TaskManager.Event<unknown, unknown>>;
    execDelayedTasks(): Observable<TaskManager.Event<unknown, unknown>>;
    execPendingTasks(): Observable<TaskManager.Event<unknown>>;
    execTasksByState(state: TaskManager.TaskState): Observable<TaskManager.Event<unknown>>;
    getTaskPosition(id: string): number;
    private _exec;
    private _onTaskExecError;
    private _cancel;
    private _emit;
    private _onError;
    private _isDelayError;
    static ɵfac: i0.ɵɵFactoryDeclaration<TaskManagerService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<TaskManagerService>;
}
export {};
