$this->activityLog->record( ActivityType::ContactRequest, sprintf('Kontaktanfrage „%s“ von %s (%s).', $model->topic->label(), $model->name, $model->email), user: $model->user, subject: $model, actorLabel: (string) ($model->name ?: $model->email), meta: ['portal' => $this->stringable($model->portal)], ), $model instanceof LegalRequest => $this->activityLog->record( ActivityType::LegalRequest, sprintf('Rechtsanfrage (%s) von %s.', $model->type->label(), $model->requester_email), subject: $model, actorLabel: (string) $model->requester_email, meta: ['type' => $model->type->value, 'press_release_id' => $model->press_release_id], ), $model instanceof WithdrawalRequest => $this->activityLog->record( ActivityType::WithdrawalRequest, sprintf('Widerruf eingegangen von %s (%s).', $model->name, $model->email), subject: $model, actorLabel: (string) ($model->name ?: $model->email), ), $model instanceof TerminationRequest => $this->activityLog->record( ActivityType::TerminationRequest, sprintf('Kündigung (%s) von %s (%s).', $model->kind, $model->name, $model->email), subject: $model, actorLabel: (string) ($model->name ?: $model->email), meta: ['kind' => $model->kind], ), $model instanceof NewsletterSubscription => $this->activityLog->record( ActivityType::NewsletterSubscription, sprintf('Newsletter-Anmeldung von %s.', $model->email), subject: $model, actorLabel: (string) $model->email, meta: ['portal' => $this->stringable($model->portal)], ), default => null, }; } private function stringable(mixed $value): ?string { return $value instanceof \BackedEnum ? (string) $value->value : ($value !== null ? (string) $value : null); } }