import { KyooWorker } from './worker';
import type { KyooJobProcessor } from './worker';
import type { Serializable } from '@nhtio/serialization/types';
import type { KyooClient, KyooClientAdapter } from './adapters';
import type { KyooJobToEnqueue, KyooWorkable, KyooJob } from './job';
import type { KyooAdapterToQueueBus } from './utils/adapter_to_queue_bus';
import type { KyooConnectionToQueueBus } from './utils/connection_to_queue_bus';
/**
 * Represents the options for the creation of a queue worker
 */
export interface KyooQueueWorkerOptions {
    /**
     * The name of the worker
     */
    name: string;
    /**
     * If true, the job will be acknowledged automatically on retrieval
     * @remarks When the worker is in non-blocking mode, noAck must be true
     * This is to prevent memory leaks.
     */
    noAck: boolean;
    /**
     * If true, the worker will start automatically on creation
     */
    autoStart: boolean;
    /**
     * If true, the worker will process jobs one at a time.
     * When false, the worker will process jobs as they become available.
     * @remarks Use with care - this can lead to memory leaks if the processor function
     * is resource intensive.
     */
    blocking: boolean;
}
/**
 * An instance of a queue created by Kyoo with the queue broker. A queue is created by calling the `get` method of {@link KyooConnection.queues}
 * @template T - The type of the Queue Broker client. Will be one of: `amqp`, `bullmq` and `sqs`.
 */
export declare class KyooQueue<T extends KyooClient> {
    #private;
    /**
     * @private
     */
    constructor(adapter: KyooClientAdapter<T>, bus: KyooAdapterToQueueBus, name: string, connectionBus: KyooConnectionToQueueBus);
    /**
     * The name of the queue
     */
    get name(): string;
    /**
     * The number of workers attached to this queue instance
     * @remarks This number only counts the workers created by this instance of the queue, not the
     * workers created by other instances of the queue or workers created in other processes.
     */
    get workers(): number;
    /**
     * Terminate all queue subscriptions by resolving any pending promises for subscriptions
     */
    terminate(): Promise<void>;
    /**
     * An object of methods for interacting with jobs
     */
    get jobs(): {
        /**
         * Add one or more jobs to the queue
         * @param jobs The job(s) to enqueue
         */
        enqueue: <JT = Serializable>(job: KyooJobToEnqueue<JT>, ...jobs: KyooJobToEnqueue<JT>[]) => Promise<boolean | boolean[]>;
        /**
         * Get the number of jobs in the queue
         * @returns The number of jobs in the queue
         */
        enqueued: () => Promise<number>;
        /**
         * Removes all unprocessed jobs from the queue
         */
        purge: () => Promise<void>;
        /**
         * Retrieve the next job from the queue, if one is available
         */
        next: <JT = Serializable>(noAck?: boolean) => Promise<KyooWorkable<JT> | undefined>;
        /**
         * Get a list of pending jobs in the queue
         * @param count The number of jobs to retrieve. If not provided, all jobs will be retrieved.
         * @returns An array of jobs
         * @remarks Depending on the adapter this operation may be expensive.
         */
        fetch: <JT = Serializable>(count?: number) => Promise<Array<KyooJob<JT>>>;
    };
    /**
     * Create a worker for the queue
     * @param processor The function to process the job
     * @param options Options for the worker
     * @param options.name The name of the worker
     * @param options.noAck If true, the job will be acknowledged automatically on retrieval
     * @param options.autostart If true, the worker will start automatically on creation
     * @returns An instance of the KyooQueueWorker matching the desired options
     * @throws KyooUnacceptableWorkerOptionsError if the options are invalid
     */
    worker<M = Serializable>(processor: KyooJobProcessor<M>, options?: Partial<KyooQueueWorkerOptions>): KyooWorker<T, M>;
    /**
     * The version of the library
     * @returns The version of the library
     */
    get version(): string;
    /**
     * The version of the library
     * @returns The version of the library
     */
    static get version(): string;
}
/**
 * Checks if the given object is an instance of KyooQueue
 * @param obj The object to check
 * @returns A boolean indicating if the object is a KyooQueue
 * @remarks This is needed since the KyooQueue class is not exported from the module
 */
export declare const isKyooQueue: (obj: unknown) => boolean;
