timestamp = $timestamp ?? Timestamp::now(); } /** * Check if this event is for a specific entity class */ public function isEntityOfType(string $expectedClass): bool { return $this->entityClass === $expectedClass || $this->entity instanceof $expectedClass; } /** * Get event metadata */ public function getEventData(): array { return [ 'event_type' => 'entity_loaded', 'entity_class' => $this->entityClass, 'entity_id' => $this->entityId, 'timestamp' => $this->timestamp->toFloat(), 'was_lazy' => $this->wasLazy, 'loaded_data' => $this->loadedData, ]; } }