import { type DomainEvent } from '@modules/shared';

/**
 * Emitted when a user successfully creates a saved search. Drives downstream
 * usage metering (subscriptions module) without coupling search → subscriptions
 * at the application layer (A-11).
 */
export class SavedSearchCreatedEvent implements DomainEvent {
  readonly eventName = 'saved-search.created';
  readonly occurredAt: Date;

  constructor(
    /** Saved search id (used as `aggregateId`). */
    public readonly aggregateId: string,
    public readonly userId: string,
  ) {
    this.occurredAt = new Date();
  }
}
