Files
fewo-stommer/app/Enums/BookingTaskKind.php
LarsandClaude Sonnet 5.5 8442d0a3d8 V2.1: Kanalfähigkeiten, Ausführungsvarianten, Dokumentenentkopplung, Portalbestätigung
Modellwahl über Kanalfähigkeiten mit erklärten Einschränkungen, Abgleich alter Werte,
Ausführungsvarianten je Modul, getrennte Vertrags-/Buchungsinformation, Warten auf
die Portalbestätigung mit Eskalation und Wiederaufnahme (Fälle C und D getestet).

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

116 lines
4.9 KiB
PHP
Raw Permalink 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\Mail\PaymentReminder;
use Filament\Support\Contracts\HasLabel;
/**
* What the landlord has to do about a booking. Payment tasks are created by the daily run; nothing is
* sent to the guest until the landlord has checked the payment and chooses to send the mail.
*
* Package 9 sorts every task into what it holds up: tasks of the stay ({@see self::blocksStay()}) keep the stay from
* being closed, commercial tasks ({@see self::isCommercial()}) keep the case from being settled, follow-ups hold up
* neither and simply stay on the case until they are done.
*/
enum BookingTaskKind: string implements HasLabel
{
case DepositReminder = 'deposit_reminder';
case BalanceRequest = 'balance_request';
case BalanceReminder = 'balance_reminder';
case CancellationRequest = 'cancellation_request';
case CancellationFee = 'cancellation_fee';
case PortalCancellation = 'portal_cancellation';
case PortalCancellationReported = 'portal_cancel_reported';
case PortalChangeReported = 'portal_change_reported';
case PortalConfirmationMissing = 'portal_confirmation_missing';
case RefundCheck = 'refund_check';
case BookingWish = 'booking_wish';
case ArrivalDetails = 'arrival_details';
case Service = 'service';
case Issue = 'issue';
case FollowUp = 'follow_up';
case PayoutCheck = 'payout_check';
case OpenClaim = 'open_claim';
case FactConflict = 'fact_conflict';
case ChangeRequest = 'change_request';
case GuestUnresponsive = 'guest_unresponsive';
case InboundReview = 'inbound_review';
public function getLabel(): string
{
return match ($this) {
self::DepositReminder => 'Anzahlung überfällig – anmahnen',
self::BalanceRequest => 'Restzahlung bald fällig – anfordern',
self::BalanceReminder => 'Restzahlung überfällig – anmahnen',
self::CancellationRequest => 'Stornierungswunsch des Gastes',
self::CancellationFee => 'Stornokosten prüfen und abrechnen',
self::PortalCancellation => 'Stornierung im Portal veranlassen bzw. prüfen',
self::PortalCancellationReported => 'Das Portal meldet eine Stornierung – bitte prüfen',
self::PortalChangeReported => 'Das Portal meldet eine Änderung – bitte prüfen',
self::PortalConfirmationMissing => 'Bestätigungsmail des Portals fehlt – bitte beim Portal prüfen',
self::RefundCheck => 'Erstattung an den Gast prüfen',
self::BookingWish => 'Buchungswunsch bestätigen?',
self::ArrivalDetails => 'Anreisedaten beim Gast erfragen',
self::Service => 'Leistung vorbereiten',
self::Issue => 'Abweichung oder Problem klären',
self::FollowUp => 'Folgeaufgabe',
self::PayoutCheck => 'Auszahlung des Portals prüfen',
self::OpenClaim => 'Offenen Betrag nach der Abreise klären',
self::FactConflict => 'Abweichende Angabe des Gastes prüfen',
self::ChangeRequest => 'Änderungswunsch des Gastes prüfen',
self::GuestUnresponsive => 'Fehlende Angaben selbst beim Gast nachfragen',
self::InboundReview => 'Antwort des Gastes prüfen',
};
}
/**
* Whether this is a payment reminder task (created by the daily run, settled by a payment or a reminder mail).
*/
public function isPayment(): bool
{
return in_array($this, [self::DepositReminder, self::BalanceRequest, self::BalanceReminder], true);
}
/**
* Whether an open task of this kind keeps the stay from being closed (it belongs to the stay itself).
*/
public function blocksStay(): bool
{
return in_array($this, [self::Service, self::Issue, self::PortalChangeReported], true);
}
/**
* Whether an open task of this kind keeps the case from being commercially settled.
*/
public function isCommercial(): bool
{
return $this->isPayment() || in_array($this, [self::CancellationFee, self::RefundCheck, self::PayoutCheck, self::OpenClaim], true);
}
/**
* Kinds the landlord adds by hand on a case (several per case, each with its own title).
*
* @return list<self>
*/
public static function manual(): array
{
return [self::Service, self::Issue, self::FollowUp];
}
/**
* The mail kind (App\Mail\PaymentReminder) and the booking column that records its dispatch.
*
* @return array{0: string, 1: string}|null
*/
public function reminder(): ?array
{
return match ($this) {
self::DepositReminder => [PaymentReminder::DEPOSIT_OVERDUE, 'deposit_reminded_at'],
self::BalanceRequest => [PaymentReminder::BALANCE_REQUEST, 'balance_requested_at'],
self::BalanceReminder => [PaymentReminder::BALANCE_OVERDUE, 'balance_reminded_at'],
default => null,
};
}
}