V2.1: Erweiterungspunkt-Nachweis, Fälle G/H, Abnahmeprotokoll, Status

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-05 08:17:51 +01:00
1 parent fdf226535b
commit 0d51c673eb
7 files changed
+239 -2

No files matched your search

@@ -0,0 +1,71 @@
<?php
namespace App\Process\Modules\Guest;
use App\Enums\ActivityState;
use App\Process\Activity;
use App\Process\CaseContext;
use App\Process\Modules\Dependency;
use App\Process\Modules\Module;
use App\Process\Modules\ModuleDefinition;
use App\Process\Modules\StepState;
/**
* V2.1 case H (docs/Prozessarchitektur/V2.1/ABNAHME_V2_1.md): an optional plausibility check of the guest's address, added
* at the extension point „after the guest is identified“ without touching any other model. It only informs – the result
* never holds back an offer or a booking (the address gate of v0.11 stays the only rule). Tester only until released.
*/
final class AddressCheck extends Module
{
public static function key(): string
{
return 'guest.address_check';
}
public static function definition(): ModuleDefinition
{
return new ModuleDefinition(
label: 'Anschrift auf Plausibilität prüfen',
purpose: 'Prüft, ob die Anschrift des Gastes plausibel aussieht (Postleitzahl, Ort). Es ist ein Hinweis; nichts wird dadurch aufgehalten.',
phase: 'P01',
requires: [Dependency::hard('guest.details')],
triggers: ['facts.applied'],
toggle: ModuleDefinition::TOGGLE_OPTIONAL,
events: ['facts'],
points: ['after_guest_identified'],
availability: ModuleDefinition::AVAILABILITY_TESTER_ONLY,
);
}
/**
* @return list<string> what looks implausible (empty: plausible)
*/
public function findings(CaseContext $case): array
{
$guest = $case->booking->guest;
$findings = [];
if (blank($guest?->street)) {
$findings[] = 'Straße fehlt';
}
if (blank($guest?->city)) {
$findings[] = 'Ort fehlt';
}
if (in_array(mb_strtoupper((string) $guest?->country), ['', 'DE', 'DEUTSCHLAND'], true) && ! preg_match('/^\d{5}$/', trim((string) $guest?->postal_code))) {
$findings[] = 'Postleitzahl hat nicht fünf Ziffern';
}
return $findings;
}
public function activities(CaseContext $case): array
{
$findings = $this->findings($case);
return [new Activity('address_check', 'Anschrift auf Plausibilität prüfen', ActivityState::Done, $findings === [] ? 'Anschrift wirkt plausibel' : 'Hinweis: '.implode(', ', $findings))];
}
public function state(CaseContext $case): ?StepState
{
return StepState::Done;
}
}