Files
fewo-stommer/app/Enums/ProcessSetting.php
T
LarsandClaude Opus 5.5 40d20cb7d1 Pakete 7 und 9: Auskunft und Buchungswunsch, Aufenthalt und Abschluss (Zwischenstand)
- Haltefrist 0: unverbindliche Auskunft mit signiertem Link "Buchung anfragen",
  erneute Prüfung unter Sperre, automatische oder manuelle Bestätigung, Absage
  bei vergebenem Zeitraum, Ablauf unbeantworteter Auskünfte
- Aufenthalt: Anreisedaten, Aufgaben je Wohnung, gebuchte Leistungen,
  Abweichungen und Folgeaufgaben als Aufgaben am Vorgang
- Abschluss getrennt: Aufenthalt abgeschlossen / kaufmännisch abgeschlossen,
  Nachläufer (Forderung, Auszahlung) bleiben sichtbar
- Zahlungsstatus nur aus Geld auf unserem Konto; Altbestand per Vorschau-Befehl
- Verlauf weist Testzustellungen als solche aus
- Abnahmetests T16-T25, T23 über isolierten SMTP-Empfänger

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 08:29:19 +01:00

108 lines
4.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\Enums;
/**
* The settings that shape how a case is handled. Each one has a built-in default; the landlord sets his own default,
* a property (expert area) and a channel per intake kind may deviate. A value that is not set inherits – a deliberately
* set 0, "no" or "manual" is a value of its own.
*/
enum ProcessSetting: string
{
case Processing = 'processing';
case PreReservation = 'pre_reservation';
case HoldHours = 'hold_hours';
case Documents = 'documents';
case Payments = 'payments';
case GuestMessages = 'guest_messages';
case ArrivalInfoDaysBefore = 'arrival_info_days_before';
case ContractTemplate = 'contract_template_id';
/**
* Built-in default (the behaviour before any landlord setting existed).
*/
public function default(): string|int|bool|null
{
return match ($this) {
self::Processing => ProcessingMode::Manual->value,
self::PreReservation => true,
self::HoldHours => 48,
self::Documents, self::Payments, self::GuestMessages => Responsibility::Landlord->value,
self::ArrivalInfoDaysBefore => 3,
self::ContractTemplate => null,
};
}
/**
* The question shown to the landlord, in plain words.
*/
public function question(): string
{
return match ($this) {
self::Processing => 'Wie sollen neue Vorgänge bearbeitet werden?',
self::PreReservation => 'Soll eine Anfrage den Zeitraum im Kalender reservieren?',
self::HoldHours => 'Wie lange gilt ein Angebot bzw. eine unverbindliche Auskunft (mit Reservierung: so lange bleibt der Zeitraum reserviert)?',
self::Documents => 'Wer schickt dem Gast Vertrag bzw. Buchungsunterlagen?',
self::Payments => 'Wer kümmert sich um die Zahlungen des Gastes?',
self::GuestMessages => 'Wer schickt dem Gast Anreise-Informationen und die Bitte um eine Bewertung?',
self::ArrivalInfoDaysBefore => 'Wann gehen die Anreise-Informationen an den Gast?',
self::ContractTemplate => 'Welche Vertragsvorlage wird verwendet?',
};
}
/**
* Intake kinds for which a channel may deviate (empty: landlord and property level only).
*
* @return list<IntakeKind>
*/
public function channelIntakes(): array
{
return match ($this) {
self::Processing, self::Payments, self::GuestMessages, self::ContractTemplate => [IntakeKind::Inquiry, IntakeKind::Booking],
self::PreReservation, self::HoldHours => [IntakeKind::Inquiry],
self::Documents => [IntakeKind::Booking],
self::ArrivalInfoDaysBefore => [],
};
}
/**
* Whether the landlord sets this on his general settings page (the template is chosen per property or channel).
*/
public function isLandlordSetting(): bool
{
return $this !== self::ContractTemplate;
}
/**
* Normalises a stored or submitted value; null means "not set".
*/
public function normalize(mixed $value): string|int|bool|null
{
if ($value === null || $value === '') {
return null;
}
return match ($this) {
self::Processing => ($value instanceof ProcessingMode ? $value : ProcessingMode::tryFrom((string) $value))?->value,
self::Documents, self::Payments, self::GuestMessages => ($value instanceof Responsibility ? $value : Responsibility::tryFrom((string) $value))?->value,
self::PreReservation => filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
self::HoldHours, self::ArrivalInfoDaysBefore, self::ContractTemplate => is_numeric($value) ? (int) $value : null,
};
}
/**
* The value in plain words, for showing where a value comes from.
*/
public function describe(string|int|bool|null $value): string
{
return match ($this) {
self::Processing => ProcessingMode::tryFrom((string) $value)?->getLabel() ?? '–',
self::Documents, self::Payments, self::GuestMessages => Responsibility::tryFrom((string) $value)?->getLabel() ?? '–',
self::PreReservation => $value ? 'ja' : 'nein',
self::HoldHours => $value.' Stunden',
self::ArrivalInfoDaysBefore => $value.' Tage vor Anreise',
self::ContractTemplate => $value === null ? 'Texte der Webseite' : 'Vorlage Nr. '.$value,
};
}
}