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>
This commit is contained in:
1 parent
98df5e9e3b
commit
7e22e12cac
80 files changed
+4628
-445
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
|
||||
/**
|
||||
* A1 – request on our own way answered with an information "unter Vorbehalt" (package 7).
|
||||
*/
|
||||
final class A1InformationModel extends InquiryModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a1.information';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Unverbindliche Auskunft';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Die Anfrage reserviert nichts; der Gast erhält eine unverbindliche Auskunft, fragt die Buchung an, und wir bestätigen nach erneuter Prüfung verbindlich.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A1];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => false];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
|
||||
/**
|
||||
* A1 – request on our own way (website, direct): reserving request, binding offer, acceptance.
|
||||
*/
|
||||
final class A1OfferModel extends InquiryModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a1.offer';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Angebot mit Vorreservierung';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Die Anfrage reserviert den Zeitraum; sind alle Angaben da, geht das verbindliche Angebot mit Vertragsentwurf an den Gast, der es annimmt.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A1];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => true];
|
||||
}
|
||||
|
||||
public function variants(): array
|
||||
{
|
||||
return [
|
||||
Variant::make('standard', 'Angebot mit Vorreservierung'),
|
||||
Variant::make('loyalty', 'Angebot mit Stammgastrabatt (Architekturnachweis, nur im Prozess-Tester)')
|
||||
->testerOnly()
|
||||
->insert(Point::AfterGuestIdentified, 'guest.loyalty_status')
|
||||
->insert(Point::BeforePriceFixing, 'pricing.loyalty_discount'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\Responsibility;
|
||||
|
||||
/**
|
||||
* A2 – request of an intermediary answered with an information.
|
||||
*/
|
||||
final class A2InformationModel extends InquiryModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a2.information';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Portalanfrage mit Auskunft';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Die Anfrage eines Portals wird mit einer unverbindlichen Auskunft beantwortet; verbindlich wird erst die Bestätigung des Buchungswunsches.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A2];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => false];
|
||||
}
|
||||
|
||||
protected static function guestMessageOptions(): array
|
||||
{
|
||||
return [Responsibility::Landlord, Responsibility::Portal];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\Responsibility;
|
||||
|
||||
/**
|
||||
* A2 – request of an intermediary answered with our own binding offer.
|
||||
*/
|
||||
final class A2OfferModel extends InquiryModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a2.offer';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Portalanfrage mit Angebot';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Die Anfrage eines Portals wird wie eine eigene behandelt: fehlende Angaben ergänzen, Zeitraum reservieren, verbindliches Angebot, Annahme.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A2];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => true];
|
||||
}
|
||||
|
||||
protected static function guestMessageOptions(): array
|
||||
{
|
||||
return [Responsibility::Landlord, Responsibility::Portal];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\Responsibility;
|
||||
|
||||
/**
|
||||
* A3 – binding portal booking with our own handling (e.g. Destination Solutions, R08).
|
||||
*/
|
||||
final class A3PortalBookingModel extends PortalBookingModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a3.portal_booking';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Portalbuchung, eigene Abwicklung';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Das Portal bestätigt verbindlich; Vertragsunterlagen, Zahlungsforderung und -überwachung sowie Gastkommunikation übernehmen wir.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A3];
|
||||
}
|
||||
|
||||
public static function responsibilities(): Responsibilities
|
||||
{
|
||||
return Responsibilities::of(
|
||||
fixed: ['contract' => Responsibility::Portal, 'collection' => Responsibility::Landlord, 'contract_documents' => Responsibility::Landlord],
|
||||
variable: ['guest_messages' => [Responsibility::Landlord], 'supplementary_documents' => [Responsibility::Landlord, Responsibility::Nobody], 'local_services' => [Responsibility::Landlord]],
|
||||
);
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['payments' => 'landlord', 'documents' => 'landlord'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\Responsibility;
|
||||
|
||||
/**
|
||||
* A4 – binding portal booking with shared handling: portal collection, our contract documentation (e.g. FeWo-direkt, R09).
|
||||
*/
|
||||
final class A4PortalBookingModel extends PortalBookingModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a4.portal_booking';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Portalbuchung, Inkasso beim Portal';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Das Portal bestätigt verbindlich und zieht das Geld des Gastes ein; die Vertragsdokumentation senden wir. Kommunikation, ergänzende Unterlagen und Anreiseinformation sind wählbar; die Auszahlung prüfen wir.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A4];
|
||||
}
|
||||
|
||||
public static function responsibilities(): Responsibilities
|
||||
{
|
||||
return Responsibilities::of(
|
||||
fixed: ['contract' => Responsibility::Portal, 'collection' => Responsibility::Portal, 'contract_documents' => Responsibility::Landlord],
|
||||
variable: ['guest_messages' => [Responsibility::Landlord, Responsibility::Portal], 'supplementary_documents' => [Responsibility::Landlord, Responsibility::Nobody], 'local_services' => [Responsibility::Landlord]],
|
||||
);
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['payments' => 'portal', 'documents' => 'landlord'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\Responsibility;
|
||||
|
||||
/**
|
||||
* A5 – binding portal booking handled largely by the portal: collection and contract documentation at the portal.
|
||||
*/
|
||||
final class A5PortalBookingModel extends PortalBookingModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a5.portal_booking';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Portalbuchung, weitgehend beim Portal';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Das Portal bestätigt verbindlich, zieht das Geld ein und liefert die Vertragsunterlagen; wir übernehmen nur die eigenen lokalen Aufgaben und prüfen die Auszahlung.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A5];
|
||||
}
|
||||
|
||||
public static function responsibilities(): Responsibilities
|
||||
{
|
||||
return Responsibilities::of(
|
||||
fixed: ['contract' => Responsibility::Portal, 'collection' => Responsibility::Portal, 'contract_documents' => Responsibility::Portal],
|
||||
variable: ['guest_messages' => [Responsibility::Portal, Responsibility::Landlord], 'supplementary_documents' => [Responsibility::Nobody, Responsibility::Landlord], 'local_services' => [Responsibility::Landlord]],
|
||||
);
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['payments' => 'portal', 'documents' => 'portal'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\IntakeKind;
|
||||
|
||||
/**
|
||||
* A6 – own use, private stay or block (E-022/E-024): no contract, no reminders, no reviews; channels are blocked, an
|
||||
* optional stay confirmation and a payment without reminders. Has no channel configuration.
|
||||
*/
|
||||
final class A6InternalModel extends ProcessModel
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'a6.internal';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Eigenbelegung, private Überlassung, Sperre';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Eigene Nutzung, privater Aufenthalt oder Sperrzeit: Kanäle sperren, bei Bedarf Aufenthaltsbestätigung und Zahlung ohne Erinnerungen.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A6];
|
||||
}
|
||||
|
||||
public static function intakes(): array
|
||||
{
|
||||
return [IntakeKind::Internal];
|
||||
}
|
||||
|
||||
public static function responsibilities(): Responsibilities
|
||||
{
|
||||
return Responsibilities::of([]);
|
||||
}
|
||||
|
||||
public function steps(): array
|
||||
{
|
||||
return [
|
||||
Step::module('intake.record'),
|
||||
Step::module('channels.block'),
|
||||
Step::module('documents.stay_confirmation'),
|
||||
Step::module('payments.internal'),
|
||||
Step::module('case.tasks'),
|
||||
Step::module('stay'),
|
||||
Step::module('case.closure'),
|
||||
Step::module('case.settlement'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\Responsibility;
|
||||
|
||||
/**
|
||||
* Common course of a request answered on our own way (A1 direct/website, A2 via an intermediary): intake, guest's
|
||||
* details, hold and availability, our answer (binding offer or information), acceptance, then the binding booking with
|
||||
* our contract documentation, payments, stay and closing. The variants of A1/A2 share it; the models differ by intake
|
||||
* channel and what they fix.
|
||||
*/
|
||||
abstract class InquiryModel extends ProcessModel
|
||||
{
|
||||
public static function intakes(): array
|
||||
{
|
||||
return [IntakeKind::Inquiry];
|
||||
}
|
||||
|
||||
public static function responsibilities(): Responsibilities
|
||||
{
|
||||
return Responsibilities::of(
|
||||
fixed: ['contract' => Responsibility::Landlord, 'collection' => Responsibility::Landlord, 'contract_documents' => Responsibility::Landlord],
|
||||
variable: [
|
||||
'guest_messages' => static::guestMessageOptions(),
|
||||
'supplementary_documents' => [Responsibility::Landlord, Responsibility::Nobody],
|
||||
'local_services' => [Responsibility::Landlord],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Who may write to the guest: ourselves; via an intermediary also its messaging.
|
||||
*
|
||||
* @return list<Responsibility>
|
||||
*/
|
||||
protected static function guestMessageOptions(): array
|
||||
{
|
||||
return [Responsibility::Landlord];
|
||||
}
|
||||
|
||||
public function steps(): array
|
||||
{
|
||||
return [
|
||||
Step::module('intake.record'),
|
||||
Step::module('guest.details'),
|
||||
Step::point(Point::AfterGuestIdentified),
|
||||
Step::module('hold'),
|
||||
Step::module('availability.check'),
|
||||
Step::module('offer.information'),
|
||||
Step::point(Point::BeforePriceFixing),
|
||||
Step::module('offer.binding'),
|
||||
Step::point(Point::BeforeBindingOffer),
|
||||
Step::module('offer.acceptance'),
|
||||
Step::point(Point::AfterBinding),
|
||||
...self::bindingCourse(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* What follows once a case is binding – shared with the portal bookings.
|
||||
*
|
||||
* @return list<Step>
|
||||
*/
|
||||
public static function bindingCourse(): array
|
||||
{
|
||||
return [
|
||||
Step::module('documents.send'),
|
||||
Step::module('channels.block'),
|
||||
Step::module('payments.monitor'),
|
||||
Step::module('portal.payout'),
|
||||
Step::module('case.tasks'),
|
||||
Step::module('change.proposal'),
|
||||
Step::module('arrival.details'),
|
||||
Step::module('arrival.info'),
|
||||
Step::module('guest.data_request'),
|
||||
Step::point(Point::BeforeStay),
|
||||
Step::module('stay'),
|
||||
Step::module('review.request'),
|
||||
Step::point(Point::BeforeSettlement),
|
||||
Step::module('case.closure'),
|
||||
Step::module('case.settlement'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
/**
|
||||
* The fixed extension points of the process models (docs/Prozessarchitektur/Architektur/02 §5.1). A point guarantees
|
||||
* what a module inserted there can rely on – BeforePriceFixing: the case is not binding yet; AfterBinding: it is.
|
||||
* Adding a point changes every model that offers it (stage 4 of the module criteria, 02 §2).
|
||||
*/
|
||||
enum Point: string
|
||||
{
|
||||
case AfterGuestIdentified = 'after_guest_identified';
|
||||
case BeforePriceFixing = 'before_price_fixing';
|
||||
case BeforeBindingOffer = 'before_binding_offer';
|
||||
case AfterBinding = 'after_binding';
|
||||
case BeforeStay = 'before_stay';
|
||||
case BeforeSettlement = 'before_settlement';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::AfterGuestIdentified => 'nach der Identifikation des Gastes',
|
||||
self::BeforePriceFixing => 'vor der Preisfestlegung',
|
||||
self::BeforeBindingOffer => 'vor dem verbindlichen Angebot',
|
||||
self::AfterBinding => 'nach der Verbindlichkeit',
|
||||
self::BeforeStay => 'vor dem Aufenthalt',
|
||||
self::BeforeSettlement => 'vor dem Abschluss',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\IntakeKind;
|
||||
|
||||
/**
|
||||
* Common course of a booking that is already binding at a portal (A3–A5, E-036): no second acceptance and no own
|
||||
* price – the portal's total is taken over. What follows is the binding course shared with our own requests; who
|
||||
* answers for collection and contract documentation is fixed by the concrete model (decision O1).
|
||||
*/
|
||||
abstract class PortalBookingModel extends ProcessModel
|
||||
{
|
||||
public static function intakes(): array
|
||||
{
|
||||
return [IntakeKind::Booking];
|
||||
}
|
||||
|
||||
public function steps(): array
|
||||
{
|
||||
return [
|
||||
Step::module('intake.record'),
|
||||
Step::module('guest.details'),
|
||||
Step::point(Point::AfterGuestIdentified),
|
||||
Step::module('binding.portal'),
|
||||
Step::point(Point::AfterBinding),
|
||||
...InquiryModel::bindingCourse(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?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());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
/**
|
||||
* One entry of a model's course: a module or an extension point where variants insert modules.
|
||||
*/
|
||||
final readonly class Step
|
||||
{
|
||||
private function __construct(public ?string $module, public ?Point $point) {}
|
||||
|
||||
public static function module(string $key): self
|
||||
{
|
||||
return new self($key, null);
|
||||
}
|
||||
|
||||
public static function point(Point $point): self
|
||||
{
|
||||
return new self(null, $point);
|
||||
}
|
||||
|
||||
public function isPoint(): bool
|
||||
{
|
||||
return $this->point !== null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
/**
|
||||
* An admissible variant of a model: further modules at its extension points, the same case type. A variant marked
|
||||
* tester-only can be configured as a draft and played through in the process tester, never frozen into a real case.
|
||||
*/
|
||||
final class Variant
|
||||
{
|
||||
/** @var array<string, list<string>> point value => module keys */
|
||||
private array $inserts = [];
|
||||
|
||||
private bool $testerOnly = false;
|
||||
|
||||
private function __construct(public readonly string $key, public readonly string $label) {}
|
||||
|
||||
public static function make(string $key, string $label): self
|
||||
{
|
||||
return new self($key, $label);
|
||||
}
|
||||
|
||||
public function insert(Point $point, string $module): self
|
||||
{
|
||||
$this->inserts[$point->value][] = $module;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function testerOnly(): self
|
||||
{
|
||||
$this->testerOnly = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isTesterOnly(): bool
|
||||
{
|
||||
return $this->testerOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function modulesAt(Point $point): array
|
||||
{
|
||||
return $this->inserts[$point->value] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function inserts(): array
|
||||
{
|
||||
return $this->inserts;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user