Modellwahl über Kanalfähigkeiten mit erklärten Einschränkungen, Abgleich alter Werte, Ausführungsvarianten je Modul, getrennte Vertrags-/Buchungsinformation, Warten auf die Portalbestätigung mit Eskalation und Wiederaufnahme (Fälle C und D getestet). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Process\Modules\Intake;
|
|
|
|
use App\Availability\AvailabilityChecker;
|
|
use App\Enums\Execution;
|
|
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',
|
|
executions: [Execution::Automatic],
|
|
condition: 'bei jeder Anfrage vor Angebot oder Bestätigung',
|
|
why: 'Doppelbuchungen sind nicht zu verantworten (E-027); die Verfügbarkeit wird immer geprüft.',
|
|
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;
|
|
}
|
|
}
|