Files
fewo-stommer/app/Process/Models/Responsibilities.php
T
LarsandClaude Opus 5.5 7e22e12cac U-A/U-B: Prozesskern mit Fachmodulen, versionierten Modellen, eingefrorenem Prozessplan, ProcessRunner (harte/weiche Abhängigkeiten), CasePricing, Loyalty nur im Tester
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>
2026-11-04 14:49:44 +01:00

71 lines
2.4 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\Models;
use App\Enums\ProcessSetting;
use App\Enums\Responsibility;
/**
* Who answers for what in a model (docs/Prozessarchitektur/Architektur/03 §2.3, decision E1/O1). The model fixes the
* responsibilities that decide the case type – contract, collection of the guest's money, binding contract
* documentation – and allows a set of values for the others; the configurator offers exactly these values at the step.
*/
final class Responsibilities
{
/** Responsibility fields that exist today as process settings. */
public const SETTINGS = [
'collection' => ProcessSetting::Payments,
'contract_documents' => ProcessSetting::Documents,
'guest_messages' => ProcessSetting::GuestMessages,
];
public const LABELS = [
'contract' => 'Vertragsabschluss',
'collection' => 'Inkasso (Geld des Gastes)',
'contract_documents' => 'Vertragsdokumentation',
'supplementary_documents' => 'Ergänzende Gastunterlagen',
'guest_messages' => 'Gastkommunikation und Anreiseinformation',
'local_services' => 'Lokale Leistungen',
];
/**
* @param array<string, Responsibility> $fixed
* @param array<string, list<Responsibility>> $variable
*/
private function __construct(public readonly array $fixed, public readonly array $variable) {}
/**
* @param array<string, Responsibility> $fixed
* @param array<string, list<Responsibility>> $variable
*/
public static function of(array $fixed, array $variable = []): self
{
return new self($fixed, $variable);
}
public function isFixed(string $field): bool
{
return array_key_exists($field, $this->fixed);
}
/**
* The values the configurator may offer for a field (one value when the model fixes it).
*
* @return list<Responsibility>
*/
public function allowed(string $field): array
{
return $this->isFixed($field) ? [$this->fixed[$field]] : ($this->variable[$field] ?? []);
}
/**
* Whether a setting value fits the model (used by the configurator and by the plausibility check of a plan).
*/
public function admits(ProcessSetting $setting, Responsibility $value): bool
{
$field = array_search($setting, self::SETTINGS, true);
return $field === false || $this->allowed($field) === [] || in_array($value, $this->allowed($field), true);
}
}