/**
 * Domain Event: HeartbeatReceived
 * Emitted when a heartbeat is received from a client.
 * Used to update presence tracking and trigger metrics updates.
 */
export class HeartbeatReceivedEvent {
  readonly eventType = 'heartbeat.received' as const;
  readonly occurredAt: Date;

  constructor(
    public readonly userId: string,
    public readonly installId: string,
    public readonly appVersion: string,
  ) {
    this.occurredAt = new Date();
  }

  toJSON() {
    return {
      eventType: this.eventType,
      userId: this.userId,
      installId: this.installId,
      appVersion: this.appVersion,
      occurredAt: this.occurredAt.toISOString(),
    };
  }
}
