import { Command } from '../core/command';
import { AggregateRoot } from '../core/aggregate-root';
import { EventStore } from '../core/event-store.interface';
import { CommandResult, CommandContext } from '../types';
import { EventBus } from './event.publisher';
/**
 * Command execution error
 */
export declare class CommandExecutionError extends Error {
    readonly commandId: string;
    readonly aggregateId: string;
    readonly originalError?: Error | undefined;
    constructor(message: string, commandId: string, aggregateId: string, originalError?: Error | undefined);
}
/**
 * Command validation error
 */
export declare class CommandValidationError extends Error {
    readonly commandId: string;
    readonly validationErrors: string[];
    constructor(message: string, commandId: string, validationErrors: string[]);
}
/**
 * Optimistic concurrency error
 */
export declare class OptimisticConcurrencyError extends Error {
    constructor(aggregateId: string, expectedVersion: number, actualVersion: number);
}
/**
 * Service for handling commands
 */
export declare class CommandHandler {
    private readonly eventStore;
    private readonly eventBus?;
    private readonly logger;
    constructor(eventStore: EventStore, eventBus?: EventBus | undefined);
    /**
     * Executes command for aggregate
     */
    execute<T extends AggregateRoot>(aggregate: T, command: Command, context?: CommandContext): Promise<CommandResult>;
    /**
     * Validates command
     */
    private validateCommand;
    /**
     * Creates default context
     */
    private createDefaultContext;
    /**
     * Gets handler method name for command
     */
    private getHandlerMethodName;
    /**
     * Loads aggregate from Event Store
     */
    private loadAggregate;
    /**
     * Saves aggregate in Event Store
     */
    private saveAggregate;
    /**
     * Creates snapshot if needed
     */
    private createSnapshotIfNeeded;
}
//# sourceMappingURL=command.handler.d.ts.map