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>
104 lines
2.8 KiB
PHP
104 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Process\Models;
|
|
|
|
use App\Enums\CaseType;
|
|
use App\Enums\IntakeKind;
|
|
use App\Enums\ProcessSetting;
|
|
|
|
/**
|
|
* A centrally defined, versioned process model (docs/Prozessarchitektur/Architektur/02 §5): its course of steps with
|
|
* extension points, its admissible variants and the responsibilities it fixes. The case type stays the derived
|
|
* classification (ProcessProfile::caseTypeFor); a model only declares which case types it is admissible for.
|
|
* The landlord chooses among models, he never defines one.
|
|
*/
|
|
abstract class ProcessModel
|
|
{
|
|
abstract public static function key(): string;
|
|
|
|
abstract public static function version(): int;
|
|
|
|
abstract public static function label(): string;
|
|
|
|
abstract public static function description(): string;
|
|
|
|
/** @return list<CaseType> */
|
|
abstract public static function caseTypes(): array;
|
|
|
|
/** @return list<IntakeKind> */
|
|
abstract public static function intakes(): array;
|
|
|
|
abstract public static function responsibilities(): Responsibilities;
|
|
|
|
/** @return list<Step> */
|
|
abstract public function steps(): array;
|
|
|
|
/**
|
|
* Settings the model fixes for its cases (e.g. the pre-reservation of the offer model).
|
|
*
|
|
* @return array<string, string|int|bool>
|
|
*/
|
|
public static function fixes(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* @return list<Variant>
|
|
*/
|
|
public function variants(): array
|
|
{
|
|
return [Variant::make('standard', 'Standard')];
|
|
}
|
|
|
|
public function variant(string $key): ?Variant
|
|
{
|
|
foreach ($this->variants() as $variant) {
|
|
if ($variant->key === $key) {
|
|
return $variant;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* The modules of the course in order, with the variant's modules at their points.
|
|
*
|
|
* @return list<string>
|
|
*/
|
|
public function modules(?string $variant = 'standard'): array
|
|
{
|
|
$chosen = $this->variant($variant ?? 'standard');
|
|
$modules = [];
|
|
foreach ($this->steps() as $step) {
|
|
if ($step->isPoint()) {
|
|
array_push($modules, ...($chosen?->modulesAt($step->point) ?? []));
|
|
} else {
|
|
$modules[] = $step->module;
|
|
}
|
|
}
|
|
|
|
return $modules;
|
|
}
|
|
|
|
/**
|
|
* @return list<Point>
|
|
*/
|
|
public function points(): array
|
|
{
|
|
return array_values(array_map(fn (Step $step): Point => $step->point, array_filter($this->steps(), fn (Step $step): bool => $step->isPoint())));
|
|
}
|
|
|
|
public static function reference(): string
|
|
{
|
|
return static::key().'@'.static::version();
|
|
}
|
|
|
|
/** Whether the model fixes the setting (the configurator shows it, but not as a choice). */
|
|
public static function fixesSetting(ProcessSetting $setting): bool
|
|
{
|
|
return array_key_exists($setting->value, static::fixes());
|
|
}
|
|
}
|