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>
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Process\Modules\Intake;
|
|
|
|
use App\Availability\AvailabilityChecker;
|
|
use App\Process\CaseContext;
|
|
use App\Process\Modules\Module;
|
|
use App\Process\Modules\ModuleDefinition;
|
|
use App\Process\Modules\StepState;
|
|
|
|
/**
|
|
* P01/P02: the dates are free (calendar truth of AvailabilityChecker, fresh imports by CalendarClearance). Mandatory
|
|
* and never switched off; the offer depends on it hard.
|
|
*/
|
|
final class AvailabilityCheck extends Module
|
|
{
|
|
public static function key(): string
|
|
{
|
|
return 'availability.check';
|
|
}
|
|
|
|
public static function definition(): ModuleDefinition
|
|
{
|
|
return new ModuleDefinition(
|
|
label: 'Verfügbarkeit',
|
|
purpose: 'Prüft, ob der Zeitraum frei ist und die Kalender der Portale aktuell sind.',
|
|
phase: 'P01',
|
|
effects: ['network'],
|
|
triggers: ['intake', 'facts.applied'],
|
|
);
|
|
}
|
|
|
|
public function applies(CaseContext $case): bool
|
|
{
|
|
return $case->inquiry && ! $case->binding;
|
|
}
|
|
|
|
public function activities(CaseContext $case): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function state(CaseContext $case): ?StepState
|
|
{
|
|
$booking = $case->booking;
|
|
|
|
return app(AvailabilityChecker::class)->isAvailable($booking->property, $booking->arrival, $booking->departure, ignore: $booking) ? StepState::Done : StepState::Problem;
|
|
}
|
|
}
|