- CaseRequirements: Vor einem eigenen verbindlichen Angebot und vor der verbindlichen Bestätigung eines Buchungswunsches müssen Vor- und Nachname, E-Mail, vollständige Anschrift mit Land, Personenzahl und Zeitraum vorliegen – harter Blocker, auch von Hand (G2a, B3). Die Auskunft unter Vorbehalt bleibt ohne dieses Gate. - ContributeCaseFacts (S5): jede Angabe mit Herkunft und Ergebnis in case_facts; fehlend → übernommen, gleich → bestätigt, abweichend vom Gast → Prüfaufgabe (Kartei bleibt), Vermieterin maßgeblich, Zeitraum und Personen → Änderungswunsch; idempotent; danach einmal CaseAutomation. - ProvideGuestContact und Webformular nutzen den Fakteneingang. - Land als ISO-Code mit „Deutschland“ als änderbarem Formularstandard; guests.country ohne stillen Standardwert (B4). - Testdaten bestehender Tests um Anschriften ergänzt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
1.8 KiB
PHP
66 lines
1.8 KiB
PHP
<?php
|
||
|
||
namespace App\Models;
|
||
|
||
use App\Enums\FactSource;
|
||
use App\Models\Concerns\BelongsToTenant;
|
||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||
use Illuminate\Database\Eloquent\Model;
|
||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
||
/**
|
||
* One detail that arrived for a case, with its source and what became of it (v0.11, S5). Only appended, never
|
||
* changed: the evidence behind the values in guests and bookings.
|
||
*/
|
||
#[Fillable(['booking_id', 'field', 'value', 'previous_value', 'source', 'inbound_message_id', 'evidence', 'confidence', 'outcome', 'fingerprint', 'actor', 'created_at'])]
|
||
class CaseFact extends Model
|
||
{
|
||
use BelongsToTenant;
|
||
|
||
public const UPDATED_AT = null;
|
||
|
||
public const APPLIED = 'applied';
|
||
|
||
public const CONFIRMED = 'confirmed';
|
||
|
||
public const CONFLICT = 'conflict';
|
||
|
||
public const CHANGE_REQUEST = 'change_request';
|
||
|
||
public const REJECTED = 'rejected';
|
||
|
||
/**
|
||
* @return array<string, string>
|
||
*/
|
||
protected function casts(): array
|
||
{
|
||
return [
|
||
'value' => 'encrypted',
|
||
'previous_value' => 'encrypted',
|
||
'evidence' => 'encrypted',
|
||
'source' => FactSource::class,
|
||
'confidence' => 'float',
|
||
'created_at' => 'immutable_datetime',
|
||
];
|
||
}
|
||
|
||
/**
|
||
* @return BelongsTo<Booking, $this>
|
||
*/
|
||
public function booking(): BelongsTo
|
||
{
|
||
return $this->belongsTo(Booking::class);
|
||
}
|
||
|
||
public function outcomeLabel(): string
|
||
{
|
||
return match ($this->outcome) {
|
||
self::APPLIED => 'übernommen',
|
||
self::CONFIRMED => 'bestätigt (gleicher Wert)',
|
||
self::CONFLICT => 'weicht ab – zur Prüfung',
|
||
self::CHANGE_REQUEST => 'Änderungswunsch – zur Prüfung',
|
||
default => 'nicht verwendbar',
|
||
};
|
||
}
|
||
}
|