import { Event } from './event';
/**
 * Error thrown when aggregate is not found
 */
export declare class AggregateNotFoundError extends Error {
    constructor(aggregateId: string, aggregateType: string);
}
/**
 * Error thrown when trying to apply wrong event to aggregate
 */
export declare class InvalidEventError extends Error {
    constructor(eventType: string, aggregateType: string);
}
/**
 * Base class for all aggregates in Event Sourcing system
 */
export declare abstract class AggregateRoot<T = string> {
    /**
     * Unique aggregate identifier
     */
    protected id: T;
    /**
     * Current aggregate version
     */
    protected version: number;
    /**
     * List of uncommitted events
     */
    private uncommittedEvents;
    /**
     * Whether aggregate was loaded from Event Store
     */
    private isLoaded;
    constructor(id?: T);
    getId(): T;
    getVersion(): number;
    getIsLoaded(): boolean;
    /**
     * Applies new event to aggregate
     */
    protected apply(event: Event): void;
    /**
     * Restores aggregate from event history
     */
    loadFromHistory(events: Event[]): void;
    /**
     * Abstract method for handling events
     * Must be implemented in each aggregate
     */
    protected abstract handleEvent(event: Event): void;
    getUncommittedEvents(): Event[];
    markEventsAsCommitted(): void;
    hasUncommittedEvents(): boolean;
    getUncommittedEventsCount(): number;
    /**
     * Creates aggregate snapshot for optimization
     */
    createSnapshot(): Record<string, any>;
    /**
     * Restores aggregate from snapshot
     */
    loadFromSnapshot(snapshot: Record<string, any>): void;
    /**
     * Gets data for snapshot (should be overridden in aggregate)
     */
    protected getSnapshotData(): Record<string, any>;
    /**
     * Loads data from snapshot (should be overridden in aggregate)
     */
    protected loadSnapshotData(data: Record<string, any>): void;
    /**
     * Validates aggregate state
     */
    protected validateState(): void;
}
//# sourceMappingURL=aggregate-root.d.ts.map