'Angebot mit Annahmelink', self::Information => 'Auskunft unter Vorbehalt', self::Confirmation => 'Buchungsbestätigung mit Mietvertrag', self::ExternalRecord => 'Buchungsunterlagen (beim Portal gebucht)', self::StayConfirmation => 'Aufenthaltsbestätigung (privat)', self::Internal => 'Nur intern, kein Dokument an Gäste', self::DataRequest => 'Rückfrage nach fehlenden Angaben', }; } /** * What the landlord reads about this kind on the settings page. */ public function description(): string { return match ($this) { self::Offer => 'Für Anfragen: Preis, Vertragsentwurf und ein Link, mit dem der Gast verbindlich annimmt.', self::Information => 'Für Anfragen ohne Reservierung: Preis und Verfügbarkeit zum Zeitpunkt der Prüfung, ohne Reservierung und ohne Zusage. Der Gast kann daraus die Buchung anfragen; verbindlich wird sie erst mit Ihrer (oder der automatischen) Bestätigung nach erneuter Prüfung.', self::Confirmation => 'Nach der Annahme eines Angebots oder einer direkt vereinbarten Buchung: Bestätigung mit dem Mietvertrag.', self::ExternalRecord => 'Für Buchungen, die beim Portal bereits verbindlich sind: Buchungsdaten und – falls hinterlegt – Ihre Vorlage, ohne erneute Annahme durch den Gast.', self::StayConfirmation => 'Für private Überlassungen (Familie, Freunde): Bestätigung des Aufenthalts ohne Mietvertrag, nur auf Wunsch.', self::Internal => 'Eigennutzung und Wartung: kein Dokument an Gäste.', self::DataRequest => 'E-Mail an den Gast mit der Bitte um fehlende Angaben (Anschrift, Personenzahl …) und einem persönlichen Link zum Ergänzen, dazu Erinnerungen und gezielte Folgefragen. Sie nennt nur eine tatsächlich bestehende vorläufige Reservierung. Im Testbetrieb gehen die Texte auch ohne Freigabe hinaus (nur an die Testadresse).', }; } /** * The document a case needs at its current stage, or null when nobody needs one from us (e.g. the portal sends it). */ public static function forCase(Booking $booking): ?self { $profile = $booking->process(); return match (true) { $booking->intake === IntakeKind::Internal => $booking->guest_id !== null ? self::StayConfirmation : self::Internal, $booking->caseType()->isExternallyBinding() => $profile->documents() === Responsibility::Portal ? null : self::ExternalRecord, $booking->isBinding() => $profile->documents() === Responsibility::Portal ? null : self::Confirmation, ! $profile->preReservation() => self::Information, default => self::Offer, }; } /** * Whether the guest makes the contract by accepting this document (only the offer carries an acceptance link). */ public function hasAcceptanceLink(): bool { return $this === self::Offer; } /** * Whether a rental contract is part of this document. */ public function containsContract(): bool { return in_array($this, [self::Offer, self::Confirmation, self::ExternalRecord], true); } /** * Whether this kind can be sent with the current packages (the others exist as working drafts only). */ public function isAvailable(): bool { return in_array($this, [self::Offer, self::Information, self::Confirmation, self::ExternalRecord, self::StayConfirmation, self::DataRequest], true); } /** * Whether the texts of this kind count as released while the landlord has not decided otherwise: the offer and the * confirmation are the documents in use since the start; every new kind starts as a working draft. */ public function releasedByDefault(): bool { return in_array($this, [self::Offer, self::Confirmation], true); } /** * Whether this kind goes to guests at all. */ public function isForGuests(): bool { return $this !== self::Internal; } /** * File name prefix of the stored PDF. */ public function fileName(): string { return match ($this) { self::Offer => 'Angebot', self::Information => 'Auskunft', self::Confirmation => 'Mietvertrag', self::ExternalRecord => 'Buchungsunterlagen', self::StayConfirmation => 'Aufenthaltsbestaetigung', self::Internal => 'Intern', self::DataRequest => 'Rueckfrage', }; } }