import { Types } from "..";
import { ConnectionStatusEventType, ConnectionSubscription, EventCallback, SubscriberForEvents, SubscriberForInboxEvents, SubscriberForKvdbEvents, SubscriberForStoreEvents, SubscriberForThreadsEvents, SubscriberForUserEvents, Subscription } from "./subscriptions";
/**
 *
 * General usage
 *
 * const fn1 = () =>{}
 * const fn2 = () =>{}
 *
 * const fn3 = () =>{}
 *
 *
 * const subscriptionA = createSubscription({
 *  type: Types.ThreadEventType.THREAD_CREATE,
 *  selector: Types.ThreadEventSelectorType.THREAD_CONTAINER,
 *  selectorId: "s0dvos0div0smidvmsd"
 *  callbacks: [fn1,fn2]
 * })
 *
 * const subscriptionB = createThreadSubscribtion({
 *  type: Types.ThreadEventType.MESSAGE_CREATED,
 *  selector: Types.ThreadEventSelectorType.CONTEXT_CONTAINER,
 *  selectorId: "s0dvos0div0smidvmsd"
 *  callbacks: [fn3]
 * })
 *
 * await manager.subscribeFor([subscriptionA, subscriptionB])
 *
 *
 * await manager.unsubscribeFrom(subscriptionB)
 *
 * --- or ---
 *
 * await manager.removeCallback(subscriptionA.callbacks[0])
 */
export type Channel = "inbox" | `inbox/${string}/entries` | "store" | `store/${string}/files` | "thread" | `thread/${string}/messages` | `connection/${string}` | "context/userAdded" | "context/userRemoved" | "context/userStatus" | `context/${string}/${string}`;
export interface GenericEvent<K> extends Types.Event {
    /**
     * Data associated with the event.
     */
    data: K;
}
export declare abstract class BaseEventDispatcherManager {
    private _listenersSymbols;
    private _listeners;
    get listeners(): Map<string, EventCallback[]>;
    protected abstract apiSubscribeFor(strings: string[]): Promise<string[]>;
    protected abstract apiUnsubscribeFrom(strings: string[]): Promise<void>;
    dispatchEvent(event: Types.Event): void;
    unregisterCallback(symbol: Symbol): void;
    protected prepareSubscription(channelList: string[], subscriptions: {
        callbacks: EventCallback[];
    }[]): Promise<string[]>;
    unsubscribeFrom(subscriptionsId: string[]): Promise<void>;
}
export declare class ThreadEventsManager extends BaseEventDispatcherManager {
    private threadApi;
    constructor(threadApi: SubscriberForThreadsEvents);
    protected apiSubscribeFor(channels: string[]): Promise<string[]>;
    protected apiUnsubscribeFrom(subscriptionId: string[]): Promise<void>;
    subscribeFor(subscriptions: Subscription<Types.ThreadEventType, Types.ThreadEventSelectorType>[]): Promise<string[]>;
}
export declare class StoreEventsManager extends BaseEventDispatcherManager {
    private storeApi;
    constructor(storeApi: SubscriberForStoreEvents);
    protected apiSubscribeFor(channels: string[]): Promise<string[]>;
    protected apiUnsubscribeFrom(subscriptionId: string[]): Promise<void>;
    subscribeFor(subscriptions: Subscription<Types.StoreEventType, Types.StoreEventSelectorType>[]): Promise<string[]>;
}
export declare class InboxEventsManager extends BaseEventDispatcherManager {
    private inboxApi;
    constructor(inboxApi: SubscriberForInboxEvents);
    protected apiSubscribeFor(channels: string[]): Promise<string[]>;
    protected apiUnsubscribeFrom(subscriptionId: string[]): Promise<void>;
    subscribeFor(subscriptions: Subscription<Types.InboxEventType, Types.InboxEventSelectorType>[]): Promise<string[]>;
}
export declare class KvdbEventsManager extends BaseEventDispatcherManager {
    private kvdbApi;
    constructor(kvdbApi: SubscriberForKvdbEvents);
    protected apiSubscribeFor(channels: string[]): Promise<string[]>;
    protected apiUnsubscribeFrom(subscriptionId: string[]): Promise<void>;
    subscribeFor(subscriptions: Subscription<Types.KvdbEventType, Types.KvdbEventSelectorType>[]): Promise<string[]>;
}
export declare class CustomEventsManager extends BaseEventDispatcherManager {
    private eventsApi;
    constructor(eventsApi: SubscriberForEvents);
    protected apiSubscribeFor(channels: string[]): Promise<string[]>;
    protected apiUnsubscribeFrom(subscriptionId: string[]): Promise<void>;
    subscribeFor(subscriptions: Subscription<string, Types.EventsEventSelectorType>[]): Promise<string[]>;
}
export declare const ConnectionChannels: Record<ConnectionStatusEventType, string>;
export declare class ConnectionEventsManager extends BaseEventDispatcherManager {
    private connectionId;
    constructor(connectionId: string);
    protected apiSubscribeFor(channels: string[]): Promise<string[]>;
    protected apiUnsubscribeFrom(): Promise<void>;
    subscribeFor(subscriptions: ConnectionSubscription[]): Promise<string[]>;
}
export declare class UserEventsManager extends BaseEventDispatcherManager {
    private userEventsApi;
    constructor(userEventsApi: SubscriberForUserEvents);
    protected apiSubscribeFor(channels: string[]): Promise<string[]>;
    protected apiUnsubscribeFrom(subscriptionId: string[]): Promise<void>;
    subscribeFor(subscriptions: Subscription<Types.ConnectionEventType, Types.ConnectionEventSelectorType>[]): Promise<string[]>;
}
