feat: refactored accommodation booking status model

This commit is contained in:
Björn Fromme
2026-08-19 11:46:52 +02:00
parent e8accbb3ed
commit 5a3957e143
42 changed files with 1190 additions and 277 deletions
@@ -0,0 +1,23 @@
<?php
namespace App\Enum\Groups;
/**
* How a booking record came about — deliberately orthogonal to the status, which
* carries the lifecycle. The origin is set once when the record is created and
* never changes afterwards, so an accepted offer stays recognisable as one without
* the origin ever contradicting the status it has reached.
*/
enum AccommodationBookingOrigin: string
{
case Offer = 'offer';
case Direct = 'direct';
public function label(): string
{
return match ($this) {
self::Offer => 'Angebot',
self::Direct => 'Direktbuchung',
};
}
}
@@ -2,9 +2,17 @@
namespace App\Enum\Groups;
/**
* The single lifecycle of a booking record. Every case names exactly one state and
* exactly one party it is waiting on: Angefragt and Entwurf wait on the office to
* prepare an offer, Offen waits on the customer to accept it, Eingegangen waits on
* the office to confirm. Where the record came from is not encoded here — that is
* what AccommodationBookingOrigin is for.
*/
enum AccommodationBookingStatus: string
{
case Draft = 'draft';
case Requested = 'requested';
case Open = 'open';
case Received = 'received';
case Confirmed = 'confirmed';
@@ -14,6 +22,7 @@ enum AccommodationBookingStatus: string
{
return match ($this) {
self::Draft => 'Entwurf',
self::Requested => 'Angefragt',
self::Open => 'Offen',
self::Received => 'Eingegangen',
self::Confirmed => 'Bestätigt',
@@ -1,17 +0,0 @@
<?php
namespace App\Enum\Groups;
enum AccommodationBookingType: string
{
case Inquiry = 'inquiry';
case Booking = 'booking';
public function label(): string
{
return match ($this) {
self::Inquiry => 'Anfrage',
self::Booking => 'Buchung',
};
}
}