import Context from "../context/context";
import { CommandMessage, EventMessage } from "../message";
import { Message } from "../message/message";
export interface HandleResult {
    error: Error | undefined;
    messageReceipt: string;
    result: any;
    broadcastMessages: Array<CommandMessage | EventMessage>;
}
export declare const NewHandleResult: (receipt: string, result: any, error: Error) => HandleResult;
export interface handler {
    handle: (ctx: Context, receipt: string, message: Message) => Promise<HandleResult>;
}
export interface handlerFactory {
    spawn: () => handler;
}
export interface HandlerFunctionCall {
    handled: boolean;
}
export interface HandlerConfig {
    functions: Array<(ctx: Context, message: Message) => Promise<HandleResult & HandlerFunctionCall>>;
    postHooks: Array<(ctx: Context, result: HandleResult) => Promise<Error | undefined>>;
}
export declare class Handler {
    private config;
    constructor(config: HandlerConfig);
    handle: (ctx: Context, receipt: string, message: Message) => Promise<HandleResult>;
    registerFunction: (func: (ctx: Context, message: Message) => Promise<HandleResult & HandlerFunctionCall>) => void;
}
export declare class HandlerFactory {
    private config;
    constructor(config: HandlerConfig);
    spawn(): handler;
}
