/**
 * The return type of an event handler
 */
export declare type EventReturnType = void | Promise<void>;
/**
 * Helper type to constrain event provider types
 */
export declare type EventProvider<TEvents> = Record<Extract<keyof TEvents, string>, (...args: any) => EventReturnType>;
/**
 * Helper type to constrain event names
 */
export declare type EventName<TEvents extends EventProvider<TEvents>> = Extract<keyof TEvents, string>;
/**
 * Helper to constrain event handlers
 */
export declare type EventHandler<TEvents extends EventProvider<TEvents>, TEventName extends EventName<TEvents>> = TEvents[TEventName];
/**
 * Event emitter
 */
export declare class EventEmitter<TEvents extends EventProvider<TEvents>> {
    private readonly internal;
    /**
     * @internal
     */
    constructor();
    /**
     * Add an event listener for a particular event type.
     * @param eventName - The name of the event.
     * @param handler - The event handler.
     */
    addEventListener<TName extends EventName<TEvents>>(eventName: TName, handler: EventHandler<TEvents, TName>): void;
    /**
     * Remove an event listener for a particular event type.
     * @param eventName - The name of the event.
     * @param handler - The event handler to remove. If none is provided, all
     * handlers for this event name are removed.
     */
    removeEventListener<TName extends EventName<TEvents>>(eventName: TName, handler?: EventHandler<TEvents, TName>): void;
    /**
     * Remove all event listeners.
     */
    removeAllEventListeners(): void;
    /**
     * Emit an event of the given type.
     * @param eventName - The name of the event.
     * @param args - The event arguments.
     */
    protected emit<TName extends EventName<TEvents>>(eventName: TName, ...args: Parameters<TEvents[TName]>): void;
}
/**
 * The base event type.
 * @typeparam TData - Type of data
 */
export declare abstract class BaseEvent<TData> {
    /**
     * The data of the event.
     */
    readonly data: TData;
    /**
     * @internal
     */
    constructor(data: TData);
}
/**
 * The base request event type.
 *
 * @typeparam TAcceptedOptions - options type
 * @typeparam TAccepted - return type
 */
export declare abstract class BaseRequestEvent<TAcceptedOptions, TAccepted> {
    /**
     * Invoked when the request is accepted.
     */
    protected onAccepted?: (value: TAccepted) => void;
    /**
     * Invoked when the request is rejected
     */
    protected onRejected?: (reason?: string) => void;
    /**
     * @internal
     */
    constructor(onAccepted?: (value: TAccepted) => void, onRejected?: (reason?: string) => void);
    /**
     * Accept the request, returning the accepted object.
     * @param options - options
     * @returns accepted ojbect
     */
    accept(options?: TAcceptedOptions): Promise<TAccepted>;
    /**
     * Internal implementation of accepting.
     * @param options - options
     */
    protected abstract acceptInternal(options?: TAcceptedOptions): Promise<TAccepted>;
    /**
     * Reject the request, with an optional reason.
     * @param reason - reason
     * @returns Promise
     */
    reject(reason?: string): Promise<void>;
    /**
     * Internal implementation of rejecting
     * @param reason - reason
     * @returns Promise
     */
    protected abstract rejectInternal(reason?: string): Promise<void>;
}
