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>
64 lines
2.3 KiB
PHP
64 lines
2.3 KiB
PHP
<?php
|
||
|
||
namespace App\Process\Modules\Intake;
|
||
|
||
use App\Enums\ProcessSetting;
|
||
use App\Models\Booking;
|
||
use App\Process\CaseContext;
|
||
use App\Process\Modules\Dependency;
|
||
use App\Process\Modules\Module;
|
||
use App\Process\Modules\ModuleDefinition;
|
||
use App\Process\Modules\StepState;
|
||
|
||
/**
|
||
* P01/P02: the hold of a request – clarification hold of an incomplete request or offer hold – and its deadline. It is
|
||
* set by the intake (RequestHold under the calendar lock) and by SendOffer, it ends by ExpireReservations or the
|
||
* release; this step only watches it. It depends on the intake alone, never on the guest's details, so a request that
|
||
* waits for its address keeps its clarification hold running (requirement K1/T1).
|
||
*/
|
||
final class Hold extends Module
|
||
{
|
||
public static function key(): string
|
||
{
|
||
return 'hold';
|
||
}
|
||
|
||
public static function definition(): ModuleDefinition
|
||
{
|
||
return new ModuleDefinition(
|
||
label: 'Reservierung des Zeitraums',
|
||
purpose: 'Hält den Zeitraum während der Klärung bzw. der Angebotsfrist frei und gibt ihn nach Ablauf wieder frei.',
|
||
phase: 'P01',
|
||
requires: [Dependency::hard('intake.record')],
|
||
effects: ['calendar_hold'],
|
||
waits: ['time'],
|
||
triggers: ['intake', 'offer.sent', 'schedule:bookings:expire-holds'],
|
||
parameters: [ProcessSetting::PreReservation, ProcessSetting::HoldHours, ProcessSetting::ClarificationHoldAutoMinutes, ProcessSetting::ClarificationHoldManualMinutes],
|
||
toggle: ModuleDefinition::TOGGLE_CONDITIONAL,
|
||
events: ['hold'],
|
||
);
|
||
}
|
||
|
||
public function applies(CaseContext $case): bool
|
||
{
|
||
return $case->inquiry && $case->profile->preReservation();
|
||
}
|
||
|
||
/** The hold has no line of its own: the offer step and the situation show it. */
|
||
public function activities(CaseContext $case): array
|
||
{
|
||
return [];
|
||
}
|
||
|
||
public function state(CaseContext $case): ?StepState
|
||
{
|
||
$booking = $case->booking;
|
||
|
||
return match (true) {
|
||
$booking->isHoldActive() => StepState::Waiting,
|
||
$booking->hold_expires_at === null && $booking->hold_purpose === Booking::HOLD_CLARIFICATION => StepState::NotApplicable,
|
||
default => StepState::Done,
|
||
};
|
||
}
|
||
}
|