['label' => 'Medium', 'default' => 'whatsapp', 'type' => 'select', 'options' => ['whatsapp' => 'WhatsApp', 'chat' => 'Chat']], 'reference' => ['label' => 'Bezug', 'default' => 'verified', 'type' => 'select', 'options' => ['verified' => 'überprüfter Bezug zum Vorgang', 'none' => 'kein Bezug (nur Absender)', 'contradicting' => 'überprüfter Bezug, Text nennt andere Nummer']], 'consent' => ['label' => 'Einwilligung des Gastes liegt vor', 'default' => true, 'type' => 'bool'], ]; } public function events(array $inputs): array { return [ new ScenarioEvent('Anfrage des Gastes liegt vor', fn (SandboxContext $context) => $context->request([])), new ScenarioEvent('Nachricht des Gastes im anderen Medium', function (SandboxContext $context) use ($inputs): void { $reference = (string) ($inputs['reference'] ?? 'verified'); $text = 'Wir kommen am Anreisetag gegen 16 Uhr an.'.($reference === 'contradicting' ? ' Vorgang 2099-0001' : ''); app(MessageIntake::class)->handle(new IncomingMessage( Medium::tryFrom((string) ($inputs['medium'] ?? 'whatsapp')) ?? Medium::WhatsApp, '+49170000000', $text, CarbonImmutable::now(), 'tester-'.md5($text), $reference === 'none' ? null : $context->booking?->id, (bool) ($inputs['consent'] ?? true), )); }), ]; } }