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 */ 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, }; } }