V2.1: Kommunikation nach Medium, Absicht und Wirkung (Fälle E/F)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8442d0a3d8
commit
8026eceab4
13 files changed
+633
-2
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Communication;
|
||||
|
||||
use App\Enums\Medium;
|
||||
use App\Enums\MessageEffect;
|
||||
use App\Enums\MessageIntent;
|
||||
use App\Models\Booking;
|
||||
|
||||
/**
|
||||
* What the process core decided about a message (V2.1): intent, case (only if verified), the effects that apply and why.
|
||||
*/
|
||||
final readonly class MessageDecision
|
||||
{
|
||||
/**
|
||||
* @param list<MessageEffect> $effects applied effects, in order
|
||||
* @param list<string> $reasons plain-language explanation
|
||||
*/
|
||||
public function __construct(
|
||||
public Medium $medium,
|
||||
public MessageIntent $intent,
|
||||
public ?Booking $booking,
|
||||
public array $effects,
|
||||
public array $reasons,
|
||||
) {}
|
||||
|
||||
public function has(MessageEffect $effect): bool
|
||||
{
|
||||
return in_array($effect, $this->effects, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{medium: string, intent: string, booking_id: ?int, effects: list<string>, reasons: list<string>}
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return ['medium' => $this->medium->value, 'intent' => $this->intent->value, 'booking_id' => $this->booking?->id,
|
||||
'effects' => array_map(fn (MessageEffect $effect): string => $effect->value, $this->effects), 'reasons' => $this->reasons];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user