import { EventEmitter } from "eventemitter3";
import { Task } from "./Task";
import { Callable, TaskPriority } from "./types";
/**
 * Channel class (queue)
 * @augments EventEmitter
 */
export declare class Channel extends EventEmitter {
    private _autostart;
    private _name;
    private _running;
    private _taskErrors;
    private _tasks;
    private _tasksThrow;
    /**
     * Constructor for a Channel
     * @param {String} name The name of the channel
     * @memberof Channel
     */
    constructor(name: string);
    /**
     * Whether the execution should start automatically or not
     * Defaults to true
     * @type {Boolean}
     * @memberof Channel
     */
    get autostart(): boolean;
    /**
     * Whether the queue is empty or not
     * @type {Boolean}
     * @readonly
     * @memberof Channel
     */
    get isEmpty(): boolean;
    /**
     * Whether the queue is currently running or not
     * @type {Boolean}
     * @readonly
     * @memberof Channel
     */
    get isRunning(): boolean;
    /**
     * The name of the channel
     * @type {String}
     * @readonly
     * @memberof Channel
     */
    get name(): string;
    /**
     * Array of tasks (in queue)
     * @type {Array.<Task>}
     * @readonly
     * @memberof Channel
     */
    get tasks(): Task[];
    /**
     * Whether or not tasks throw errors
     * @type {Boolean}
     * @memberof Channel
     */
    get tasksThrow(): boolean;
    set autostart(auto: boolean);
    set isRunning(isRunning: boolean);
    set tasksThrow(tasksThrow: boolean);
    /**
     * Remove all pending tasks from the channel
     * @param {String=} priorityType Optional priority type to clear
     *  only tasks with a certain priority value
     * @memberof Channel
     */
    clear(priorityType: TaskPriority): void;
    /**
     * Enqueues a function
     * @param {Function|Promise} item The item to place into the queue
     * @param {TaskPriority=} type The task priority to use
     * @param {String=} stack The stack name
     * @param {Number=} timeout Optional millisecond time-limt
     * @returns {Promise} A promise that eventually resolves with the result from the
     *  enqueued function or promise
     * @memberof Channel
     */
    enqueue<T>(item: Callable<T>, type?: TaskPriority, stack?: string, timeout?: number): Promise<T>;
    /**
     * Get all task items for a stack name
     * @param {String} stack The stack name
     * @returns {Array.<Task>} An array of task instances
     * @memberof Channel
     */
    getStackedItems(stack: string): Task[];
    /**
     * Get the next queued Task instance
     * This modifies the task queue by removing the task
     * @returns {Task|undefined} A task instance if there are any in queue
     * @memberof Channel
     */
    retrieveNextItem(): Task | undefined;
    /**
     * Sort the tasks
     * @memberof Channel
     */
    sort(): void;
    /**
     * Start processing the queue
     * Will automatically return early if queue has already started
     * @fires Channel#started
     * @fires Channel#stopped
     * @returns {Boolean} Returns true if started, false if already started
     * @memberof Channel
     */
    start(): boolean;
    /**
     * Wait for the queue to become empty
     * @returns {Promise}
     */
    waitForEmpty(opts?: {
        throwForFailures?: boolean;
    }): Promise<void>;
    _runNextItem(): void;
}
