CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11: 11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002). Volle Suite vor U-B: 785/785. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
||
|
||
namespace App\Process;
|
||
|
||
use App\Models\Booking;
|
||
|
||
/**
|
||
* Facade of the process core (ProcessRunner, trigger 'automation') for the places that carry a case on after new
|
||
* facts, portal amounts or the landlord's "continue automatically": only what the landlord would do next anyway and
|
||
* only when the case is handled automatically – the offer or information of a request, the documents of a binding
|
||
* booking (never for cases taken over from the old data). Whatever stops it is returned in plain words.
|
||
*/
|
||
class CaseAutomation
|
||
{
|
||
public function __construct(private ProcessRunner $runner) {}
|
||
|
||
/**
|
||
* @return list<string> what keeps the case from going on automatically (empty: nothing to do or done)
|
||
*/
|
||
public function advance(Booking $booking): array
|
||
{
|
||
return $this->runner->advance($booking, ProcessRunner::AUTOMATION)->reasons();
|
||
}
|
||
|
||
/**
|
||
* What is missing before the documents of a binding case can go to the guest.
|
||
*
|
||
* @return list<string>
|
||
*/
|
||
public function documentBlockers(Booking $booking): array
|
||
{
|
||
return array_values(array_filter([
|
||
$booking->guest === null ? 'Name und Kontaktdaten des Gastes fehlen.' : null,
|
||
$booking->guest !== null && blank($booking->guest->email) ? 'Die E-Mail-Adresse des Gastes fehlt.' : null,
|
||
$booking->total === null ? 'Der Gesamtpreis (laut Portal) fehlt.' : null,
|
||
]));
|
||
}
|
||
}
|