import { Command } from "./command/Command";
import { Event } from "../eventDispatcher/event/Event";
import { CommandMappingImpl } from "./data/impl/CommandMappingImpl";
import { Type } from "../type";
import { CommandMapping } from "./data/CommandMapping";
import { Injector } from "../injector/Injector";
import { EventGuard } from "..";
/**
* Event command map describes event name to command class mappings and is useful as small pieces of control code
* should be executed upon some event notification.
*/
export declare class CommandMap {
protected readonly injector: Injector;
private commandMappings;
/**
* Map event notification to a command class.
* @param eventType String event name which will tiger execution of a command.
* @param command Command class which should implement Command interface or, at least,
* should have execute method defined with same signature.
* @param executeOnce Set to true if event mapping should be removed after first successful execution
* @param guard Default event guard, guarding command execution from improper events.
* @returns {CommandMapping} data object which describes mapping and can be used to set command execution
* only once; or null in case if mapping of requested event type is already mapped to class instance.
*/
map(eventType: Event['type'], command: Type, executeOnce?: boolean, guard?: EventGuard): CommandMapping;
/**
* Remove all command mappings from all event types.
* @returns {boolean} which indicates if the unMapping has been successful.
*/
unMap(): boolean;
/**
* Remove all command mappings for the specified event type.
* @param eventType Event type which is mapped to commands.
* @returns {boolean} which indicates if the unMapping has been successful.
*/
unMap(eventType: string): boolean;
/**
* Remove event type to command mapping.
* @param eventType Event type which is mapped to a command.
* @param command Command class which should be unmapped.
* @returns {boolean} which indicates if the unMapping has been successful.
*/
unMap(eventType: Event['type'], command: Type): boolean;
/**
* Trigger all commands which are mapped to this event.
* @param event Event object that defines event type and data
*/
trigger(event: Event): void;
/**
* Trigger all commands which are mapped to event name.
* @param eventType String event name commands mapped to which must be invoked.
* @param eventData Arbitrary data to be passed along with command invocation.
*/
trigger(eventType: string, eventData?: any): void;
/**
* Get list of all commands assigned to particular event name.
* @param eventType String event name which is a target.
* @param command Command to which event is mapped or nothing in case if that is not required look up param.
* @returns {CommandMappingImpl[]} List of commands mappings attached to requested event type.
*/
private getEventToCommandMappings;
/**
* Create command instance and execute it.
*/
private executeCommand;
/**
* Implementation of a routine how individual command instance is created.
* (This functionality may be overridden by sub classes)
*/
protected createCommandInstance(commandMapping: CommandMappingImpl, event: Event): Command;
/**
* Number of active mappings on this Command Map instance.
* @returns {number}
*/
get mappingCount(): number;
}