/// <reference types="node" />
import { EventEmitter } from "events";
import { Job, JobEmit, Jobs } from "..";
import { WorkerOptions } from "../types/options";
import { Connection } from "./connection";
import { Queue } from "./queue";
export declare interface Worker {
    options: WorkerOptions;
    jobs: Jobs;
    started: boolean;
    name: string;
    queues: Array<string>;
    queue: string;
    originalQueue: string | null;
    error: Error | null;
    result: any;
    ready: boolean;
    running: boolean;
    working: boolean;
    pingTimer: NodeJS.Timeout;
    job: Job<any>;
    connection: Connection;
    queueObject: Queue;
    id: number;
    on(event: "start" | "end" | "pause", cb: () => void): this;
    on(event: "cleaning_worker", cb: (worker: Worker, pid: string) => void): this;
    on(event: "poll", cb: (queue: string) => void): this;
    on(event: "ping", cb: (time: number) => void): this;
    on(event: "job", cb: (queue: string, job: Job<any> | JobEmit) => void): this;
    on(event: "reEnqueue", cb: (queue: string, job: JobEmit, plugin: string) => void): this;
    on(event: "success", cb: (queue: string, job: JobEmit, result: any, duration: number) => void): this;
    on(event: "failure", cb: (queue: string, job: JobEmit, failure: any, duration: number) => void): this;
    on(event: "error", cb: (error: Error, queue: string, job: Job<any> | JobEmit) => void): this;
    once(event: "start" | "end" | "pause", cb: () => void): this;
    once(event: "cleaning_worker", cb: (worker: Worker, pid: string) => void): this;
    once(event: "poll", cb: (queue: string) => void): this;
    once(event: "ping", cb: (time: number) => void): this;
    once(event: "job", cb: (queue: string, job: Job<any> | JobEmit) => void): this;
    once(event: "reEnqueue", cb: (queue: string, job: Job<any> | JobEmit, plugin: string) => void): this;
    once(event: "success", cb: (queue: string, job: Job<any> | JobEmit, result: any) => void): this;
    once(event: "failure", cb: (queue: string, job: Job<any> | JobEmit, failure: any) => void): this;
    once(event: "error", cb: (error: Error, queue: string, job: Job<any> | JobEmit) => void): this;
    removeAllListeners(event: WorkerEvent): this;
}
export declare type WorkerEvent = "start" | "end" | "cleaning_worker" | "poll" | "ping" | "job" | "reEnqueue" | "success" | "failure" | "error" | "pause";
export declare class Worker extends EventEmitter {
    constructor(options: any, jobs?: {});
    connect(): Promise<void>;
    start(): Promise<void>;
    private init;
    end(): any;
    private poll;
    private perform;
    performInline(func: any, args?: any[]): Promise<any>;
    private completeJob;
    private succeed;
    private fail;
    private pause;
    private getJob;
    private track;
    private ping;
    private untrack;
    checkQueues(): Promise<void>;
    private failurePayload;
    private stringQueues;
}
