Files
fewo-stommer/app/Enums/DocumentKind.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

123 lines
5.0 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;
use App\Models\Booking;
use Filament\Support\Contracts\HasLabel;
/**
* The kinds of documents a case can produce (UMSETZUNGSPLAN_v0.10 §5.4). Which one a case needs follows from its case
* type, never from a choice of the landlord: a request gets a binding offer, a booking we made ourselves gets the
* confirmation with the rental contract, a booking that is already binding on a portal gets the booking documentation
* without an acceptance link (E-004), a request without a hold gets the information "unter Vorbehalt" with the link to
* ask for the booking (package 7, E-026).
*/
enum DocumentKind: string implements HasLabel
{
case Offer = 'offer';
case Information = 'information';
case Confirmation = 'confirmation';
case ExternalRecord = 'external_record';
case StayConfirmation = 'stay_confirmation';
case Internal = 'internal';
public function getLabel(): string
{
return match ($this) {
self::Offer => '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',
};
}
/**
* 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.',
};
}
/**
* 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], 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',
};
}
}