Files
fewo-stommer/app/Enums/ProcessSetting.php
T
LarsandClaude Sonnet 5.5 221ce8ca81 Anfrage-Basisprozess inquiry.request mit Schablonen für Antwort und Gastkommunikation
Antwortart (Auskunft/Angebot) und Reservierung sind entkoppelt (neue Einstellung inquiry_answer;
pre_reservation bleibt die Reservierungsstrategie). Anlass-bezogene Absender für Anreise-Information
und Bewertungsbitte; Schablonen liefern Standardwerte unterhalb aller einstellbaren Ebenen.
A1/A2 bleiben Voreinstellungen und Altfassungen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 12:40:22 +01:00

174 lines
11 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';
case ClarificationHoldAutoMinutes = 'clarification_hold_auto_minutes';
case ClarificationHoldManualMinutes = 'clarification_hold_manual_minutes';
case DataRequest = 'data_request_mode';
case DataRequestRemindersMax = 'data_request_reminders_max';
case DataRequestFollowupsMax = 'data_request_followups_max';
case DataRequestReminderHours = 'data_request_reminder_hours';
case GuestLinkValidDays = 'guest_link_valid_days';
case FormRequiresAddress = 'form_requires_address';
case ContractDelivery = 'contract_delivery';
case BookingNotice = 'booking_notice';
case AwaitPortalConfirmation = 'await_portal_confirmation';
case PortalConfirmationWaitHours = 'portal_confirmation_wait_hours';
case InquiryAnswer = 'inquiry_answer';
case ArrivalInfoSender = 'arrival_info_sender';
case ReviewRequestSender = 'review_request_sender';
/**
* 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,
self::ClarificationHoldAutoMinutes => 15,
self::ClarificationHoldManualMinutes => 180,
self::DataRequest => DataRequestMode::Approval->value,
self::DataRequestRemindersMax => 2,
self::DataRequestFollowupsMax => 2,
self::DataRequestReminderHours => 24,
self::GuestLinkValidDays => 14,
self::FormRequiresAddress => false,
self::ContractDelivery => ContractDelivery::Follow->value,
self::BookingNotice => BookingNoticeMode::Off->value,
self::AwaitPortalConfirmation => false,
self::PortalConfirmationWaitHours => 48,
// Not set: derived (ProcessSettings) – the answer from the reservation, the senders from guest_messages.
self::InquiryAnswer, self::ArrivalInfoSender, self::ReviewRequestSender => 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?',
self::ClarificationHoldAutoMinutes => 'Wie lange wird der Zeitraum einer unvollständigen Anfrage vorläufig reserviert, wenn automatisch nachgefragt wird (0 = gar nicht)?',
self::ClarificationHoldManualMinutes => 'Wie lange wird der Zeitraum einer unvollständigen Anfrage vorläufig reserviert, wenn Sie die Rückfrage freigeben oder selbst nachfragen (0 = gar nicht)?',
self::DataRequest => 'Wie wird nach fehlenden Angaben gefragt?',
self::DataRequestRemindersMax => 'Wie oft wird höchstens erinnert, wenn der Gast nicht antwortet?',
self::DataRequestFollowupsMax => 'Wie viele gezielte Folgefragen gehen höchstens hinaus, wenn eine Antwort unvollständig ist?',
self::DataRequestReminderHours => 'Nach wie vielen Stunden ohne Antwort wird erinnert?',
self::GuestLinkValidDays => 'Wie lange gilt der Link, über den der Gast Angaben ergänzt?',
self::FormRequiresAddress => 'Muss die vollständige Anschrift schon im Anfrageformular der Webseite angegeben werden?',
self::ContractDelivery => 'Was geschieht mit dem Vertragsdokument einer verbindlichen Buchung?',
self::BookingNotice => 'Bekommt der Gast von uns eine Buchungsinformation (ohne Vertrag)?',
self::AwaitPortalConfirmation => 'Sollen Unterlagen und Nachrichten erst nach der Bestätigungsmail des Portals gehen?',
self::PortalConfirmationWaitHours => 'Wie lange wird auf die Bestätigungsmail des Portals gewartet, bevor Sie benachrichtigt werden?',
self::InquiryAnswer => 'Womit wird eine Anfrage zuerst beantwortet?',
self::ArrivalInfoSender => 'Wer schickt dem Gast die Anreise-Informationen?',
self::ReviewRequestSender => 'Wer bittet den Gast nach dem Aufenthalt um eine Bewertung?',
};
}
/**
* 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, self::ArrivalInfoSender, self::ReviewRequestSender => [IntakeKind::Inquiry, IntakeKind::Booking],
self::InquiryAnswer => [IntakeKind::Inquiry],
self::PreReservation, self::HoldHours => [IntakeKind::Inquiry],
self::Documents, self::ContractDelivery, self::BookingNotice, self::AwaitPortalConfirmation, self::PortalConfirmationWaitHours => [IntakeKind::Booking],
self::ArrivalInfoDaysBefore, self::GuestLinkValidDays => [],
self::ClarificationHoldAutoMinutes, self::ClarificationHoldManualMinutes, self::FormRequiresAddress => [IntakeKind::Inquiry],
self::DataRequest, self::DataRequestRemindersMax, self::DataRequestFollowupsMax, self::DataRequestReminderHours => [IntakeKind::Inquiry, IntakeKind::Booking],
};
}
/**
* Whether the landlord sets this on his general settings page (the template is chosen per property or channel).
*/
public function isLandlordSetting(): bool
{
return ! in_array($this, [self::ContractTemplate, self::InquiryAnswer], true);
}
/**
* 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, self::ArrivalInfoSender, self::ReviewRequestSender => ($value instanceof Responsibility ? $value : Responsibility::tryFrom((string) $value))?->value,
self::InquiryAnswer => ($value instanceof InquiryAnswer ? $value : InquiryAnswer::tryFrom((string) $value))?->value,
self::PreReservation, self::FormRequiresAddress, self::AwaitPortalConfirmation => is_bool($value) ? $value : filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
self::HoldHours, self::ArrivalInfoDaysBefore, self::ContractTemplate => is_numeric($value) ? (int) $value : null,
self::DataRequest => ($value instanceof DataRequestMode ? $value : DataRequestMode::tryFrom((string) $value))?->value,
self::ContractDelivery => ($value instanceof ContractDelivery ? $value : ContractDelivery::tryFrom((string) $value))?->value,
self::BookingNotice => ($value instanceof BookingNoticeMode ? $value : BookingNoticeMode::tryFrom((string) $value))?->value,
// 0 is a value of its own: no clarification hold, no reminder, no follow-up question.
self::ClarificationHoldAutoMinutes, self::ClarificationHoldManualMinutes, self::DataRequestRemindersMax, self::DataRequestFollowupsMax => is_numeric($value) ? max(0, (int) $value) : null,
self::DataRequestReminderHours, self::GuestLinkValidDays, self::PortalConfirmationWaitHours => is_numeric($value) ? max(1, (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, self::ArrivalInfoSender, self::ReviewRequestSender => Responsibility::tryFrom((string) $value)?->getLabel() ?? '–',
self::InquiryAnswer => InquiryAnswer::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,
self::ClarificationHoldAutoMinutes, self::ClarificationHoldManualMinutes => (int) $value === 0 ? 'keine vorläufige Reservierung' : $value.' Minuten',
self::DataRequest => DataRequestMode::tryFrom((string) $value)?->getLabel() ?? '–',
self::DataRequestRemindersMax => (int) $value === 0 ? 'keine Erinnerung' : 'höchstens '.$value.' Erinnerung'.((int) $value === 1 ? '' : 'en'),
self::DataRequestFollowupsMax => (int) $value === 0 ? 'keine Folgefrage' : 'höchstens '.$value.' Folgefrage'.((int) $value === 1 ? '' : 'n'),
self::DataRequestReminderHours => 'nach '.$value.' Stunden',
self::GuestLinkValidDays => $value.' Tage',
self::FormRequiresAddress => $value ? 'ja, Pflichtangabe' : 'nein, kann nachgefragt werden',
self::ContractDelivery => ContractDelivery::tryFrom((string) $value)?->getLabel() ?? '–',
self::BookingNotice => BookingNoticeMode::tryFrom((string) $value)?->getLabel() ?? '–',
self::AwaitPortalConfirmation => $value ? 'ja, erst nach der Bestätigungsmail' : 'nein',
self::PortalConfirmationWaitHours => $value.' Stunden',
};
}
}