import type { KyooQueue } from './queue';
import type { KyooConnectionToApplicationEventEmitterKey as Key, KyooConnectionToApplicationEventEmitterListener as Listener } from './utils/connection_to_application_event_emitter';
import type { KyooClient, KyooConfiguration, ConnectionStatus } from './adapters';
/**
 * The main class for interacting with a Queue Broker.
 * @remarks This class is used to create a connection to a Queue Broker and manage queues.
 * @template T - The type of the Queue Broker client. Options are `amqp`, `bullmq` and `sqs`.
 */
export declare class KyooConnection<T extends KyooClient> {
    #private;
    constructor(config: KyooConfiguration<T>);
    /**
     * Connect to the Queue Broker
     * @param signal - An optional AbortSignal to cancel the connection
     * @remarks Can be used to reconnect to the Queue Broker after being disconnected
     */
    connect(signal?: AbortSignal): Promise<boolean>;
    /**
     * Disconnect from the Queue Broker
     * @param terminate - Whether to release all queue subscriptions
     * @remarks When `terminate` is `false`, the connection will be closed, but queue subscriptions will remain.
     * This is useful for cases where you may want to reconnect without having to resubscribe to all queues.
     * When `terminate` is `true`, the connection will be closed and all queue subscriptions will be released.
     * This is useful for cases where you want to clean up all resources, usually before shutting down the application.
     */
    disconnect(terminate?: boolean): Promise<void>;
    /**
     * The connection status
     * @returns `"connected"` if the connection is established, `disconnected` if not, `connecting` if the connection is in progress
     */
    get connectionStatus(): ConnectionStatus;
    /**
     * An object of methods for interacting with queues
     * @prop {get} queues.get - Get a queue by name
     * @prop {terminate} queues.terminate - When an arugment for `name` is provided, it will terminate the queue with that name, otherwise it will terminate all queues
     */
    get queues(): {
        /**
         * Retrieve a queue by name
         * @param name - The name of the queue to get
         * @returns The queue object
         */
        get: (name: string) => KyooQueue<T>;
        /**
         * Get the number of queues managed by this connection
         * @returns The number of queues managed by this connection
         */
        readonly count: any;
        /**
         * Terminate a queue or all queues
         * @param name - The name of the queue to terminate
         * @returns A promise that resolves when the queue(s) are terminated
         */
        terminate: (name?: string) => Promise<any>;
        /**
         * Remove a queue from the queue broker
         * @param name - The name of the queue to destroy
         */
        destroy: (name: string) => Promise<void>;
    };
    /**
     * Alias for `KyooConnection.on(eventName, listener)`.
     */
    addListener<K extends Key>(eventName: K, listener: Listener<K>): this;
    /**
     * Alias for `KyooConnection.removeListener()`.
     */
    off<K extends Key>(eventName: K, listener: Listener<K>): this;
    /**
     * Adds the `listener` function to the end of the listeners array for the event
     * named `eventName`. No checks are made to see if the `listener` has already
     * been added. Multiple calls passing the same combination of `eventName` and
     * `listener` will result in the `listener` being added, and called, multiple times.
     *
     * Returns a reference to the `KyooConnection`, so that calls can be chained.
     *
     * By default, event listeners are invoked in the order they are added. The `KyooConnection.prependListener()` method can be used as an alternative to add the
     * event listener to the beginning of the listeners array.
     *
     * @param eventName The name of the event.
     * @param listener The callback function
     */
    on<K extends Key>(eventName: K, listener: Listener<K>): this;
    /**
     * Adds a **one-time** `listener` function for the event named `eventName`. The
     * next time `eventName` is triggered, this listener is removed and then invoked.
     *
     * Returns a reference to the `KyooConnection`, so that calls can be chained.
     *
     * By default, event listeners are invoked in the order they are added. The `KyooConnection.prependOnceListener()` method can be used as an alternative to add the
     * event listener to the beginning of the listeners array.
     *
     * @param eventName The name of the event.
     * @param listener The callback function
     */
    once<K extends Key>(eventName: K, listener: Listener<K>): this;
    /**
     * Adds the `listener` function to the _beginning_ of the listeners array for the
     * event named `eventName`. No checks are made to see if the `listener` has
     * already been added. Multiple calls passing the same combination of `eventName`
     * and `listener` will result in the `listener` being added, and called, multiple times.
     *
     * Returns a reference to the `KyooConnection`, so that calls can be chained.
     * @param eventName The name of the event.
     * @param listener The callback function
     */
    prependListener<K extends Key>(eventName: K, listener: Listener<K>): this;
    /**
     * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
     * listener is removed, and then invoked.
     *
     * Returns a reference to the `KyooConnection`, so that calls can be chained.
     * @param eventName The name of the event.
     * @param listener The callback function
     */
    prependOnceListener<K extends Key>(eventName: K, listener: Listener<K>): this;
    /**
     * Removes all listeners, or those of the specified `eventName`.
     *
     * It is bad practice to remove listeners added elsewhere in the code,
     * particularly when the `KyooConnection` instance was created by some other
     * component or module.
     *
     * Returns a reference to the `KyooConnection`, so that calls can be chained.
     */
    removeAllListeners<K extends Key>(eventName?: K): this;
    /**
     * Removes the specified `listener` from the listener array for the event named `eventName`.
     *
     * `removeListener()` will remove, at most, one instance of a listener from the
     * listener array. If any single listener has been added multiple times to the
     * listener array for the specified `eventName`, then `removeListener()` must be
     * called multiple times to remove each instance.
     *
     * Once an event is emitted, all listeners attached to it at the
     * time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
     * will not remove them from`emit()` in progress. Subsequent events behave as expected.
     *
     * Because listeners are managed using an internal array, calling this will
     * change the position indices of any listener registered _after_ the listener
     * being removed. This will not impact the order in which listeners are called.
     *
     * When a single function has been added as a handler multiple times for a single
     * event, `removeListener()` will remove the most
     * recently added instance.
     *
     * Returns a reference to the `KyooConnection`, so that calls can be chained.
     */
    removeListener<K extends Key>(eventName: K, listener: Listener<K>): this;
    /**
     * Returns the count of known KyooConnections
     */
    static get active(): number;
    /**
     * Returns the list of known KyooConnections which have the status of "connected"
     */
    static get connected(): number;
    /**
     * Returns the list of known KyooConnections which have the status of "disconnected"
     */
    static get disconnected(): number;
    /**
     * Returns the list of known KyooConnections which have the status of "connecting"
     */
    static get connecting(): number;
    /**
     * Disconnects and terminates all known KyooConnections
     * @remarks This is useful for cleaning up all resources before shutting down the application.
     */
    static cleanup(): Promise<void>;
    /**
     * 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;
}
