Files
fewo-stommer/app/Process/Modules/ModuleDefinition.php
T
LarsandClaude Sonnet 5.5 8442d0a3d8 V2.1: Kanalfähigkeiten, Ausführungsvarianten, Dokumentenentkopplung, Portalbestätigung
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>
2026-11-05 07:54:11 +01:00

80 lines
3.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Process\Modules;
use App\Enums\Execution;
use App\Enums\ProcessSetting;
/**
* The contract of a module as data (docs/Prozessarchitektur/Architektur/02 §3.2). Fields marked "checked" are verified
* by `process:check` or the contract tests; the others describe and are reviewed by hand – they promise nothing a test
* cannot verify.
*
* @phpstan-type Performer 'system'|'landlord'|'guest'|'portal'|'service_provider'
*/
final readonly class ModuleDefinition
{
public const TOGGLE_MANDATORY = 'mandatory';
public const TOGGLE_OPTIONAL = 'optional';
public const TOGGLE_CONDITIONAL = 'conditional';
public const TOGGLE_EVENT_DRIVEN = 'event_driven';
public const AVAILABILITY_PRODUCTION = 'production';
/** Only in the process tester; never part of a real case's plan (decision E7, loyalty). */
public const AVAILABILITY_TESTER_ONLY = 'tester_only';
/**
* @param string $label name of the step for the landlord (describes)
* @param string $purpose what the step does, in plain words (describes)
* @param string $phase P01–P05 (checked)
* @param list<Dependency> $requires dependencies for readiness (checked: every module exists, no cycle)
* @param list<string> $effects kinds of effects the step may cause: case_write, guest_mail, landlord_mail, document, calendar_hold, channel_task, network (checked by the contract test)
* @param list<string> $waits whom or what the step can wait for: guest, portal, landlord, time (describes)
* @param list<string> $triggers events after which the step is evaluated again (describes; listed in process:check)
* @param list<ProcessSetting|string> $parameters settings or module parameters that shape the step (checked: known)
* @param string $toggle mandatory / optional / conditional / event_driven (checked: mandatory cannot be switched off)
* @param list<string> $performers who may carry the step out (checked against the models' responsibilities)
* @param list<string> $modes automatic / approval / manual (checked in the configurator)
* @param list<string> $events history types that belong to the step (shown behind the step)
* @param list<string> $points extension points the module may be inserted at (checked; empty = fixed place in a model)
* @param bool $readsContractData evaluates frozen contract data – needs an ongoing-case test (checked)
* @param list<Execution> $executions the admissible ways to fulfil the task (V2.1; the model may narrow them)
* @param string|null $condition when the step applies, in plain words (DESCRIBES – the logic is `applies()`, never read from here)
* @param string|null $why why the task is mandatory, shown instead of a lock
*/
public function __construct(
public string $label,
public string $purpose,
public string $phase,
public array $requires = [],
public array $effects = [],
public array $waits = [],
public array $triggers = [],
public array $parameters = [],
public string $toggle = self::TOGGLE_MANDATORY,
public array $performers = ['system'],
public array $modes = [],
public array $events = [],
public array $points = [],
public bool $readsContractData = false,
public string $availability = self::AVAILABILITY_PRODUCTION,
public array $executions = [],
public ?string $condition = null,
public ?string $why = null,
) {}
public function isOptional(): bool
{
return $this->toggle === self::TOGGLE_OPTIONAL;
}
public function isTesterOnly(): bool
{
return $this->availability === self::AVAILABILITY_TESTER_ONLY;
}
}