/**
 * 领域事件基类
 */
export abstract class DomainEvent {
  public readonly occurredAt: Date;
  public readonly eventId: string;

  constructor() {
    this.occurredAt = new Date();
    this.eventId = this.generateEventId();
  }

  private generateEventId(): string {
    return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
  }

  abstract get eventName(): string;
  abstract toPayload(): Record<string, unknown>;
}
