Files
fewo-stommer/app/Mail/DataRequested.php
T
LarsandClaude Opus 5.5 e4a3cb7f7b v0.11 U4: Rückfrage, Folgefrage, Erinnerung und Ergänzungslink
- data_requests: ein Beschaffungsvorgang je Vorgang mit Modus
  (automatisch / Freigabe / manuell), getrennten Zählern für Folgefragen
  und Erinnerungen ohne Rücksetzen, Antwortfrist ≠ Reservierungsfrist.
- RequestCaseData: fragt nach, was für das nächste Angebot, die
  Wunschbestätigung oder (bei verbindlichen Buchungen) administrativ fehlt;
  ohne E-Mail keine Rückfrage. Teilantwort → gezielte Folgefrage, Schweigen
  → Erinnerungen, an der Grenze Aufgabe für die Vermieterin. Nie ein Hold.
- Mail DataRequested mit Texten nach tatsächlichem Sperrstatus (M11);
  Dokumentart „Rückfrage“ – im Live-Betrieb ohne Freigabe nur nach Klick.
- Signierter, versionierter Ergänzungslink (/angebot/angaben): Lesen
  schreibt nicht, Absenden über den Fakteneingang, idempotent.
- Vorgang: „Rückfrage an den Gast senden“ / „Rückfrage beenden“;
  Eingangsbestätigung nennt die Klärungsreservierung korrekt.
- Zeitplan: cases:data-requests alle fünf Minuten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:25:48 +01:00

58 lines
2.1 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\Mail;
use App\Actions\RequestCaseData;
use App\Models\Booking;
use App\Models\DataRequest;
use App\Process\CaseRequirements;
use Carbon\CarbonImmutable;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
/**
* The question for missing details (v0.11, S4): first question, targeted follow-up or reminder, with the guest's link.
* What it says about the dates follows the real state of the case at the moment of sending (CH §2a table): no hold,
* a clarification hold until its real end, an expired one, or a booking that is already binding – never the
* configured value. The guest may also simply answer the e-mail.
*/
class DataRequested extends Mailable
{
use Queueable, SerializesModels;
/** @var array{state: 'none'|'active'|'expired', until: ?CarbonImmutable} */
public array $clarification;
/** @var list<string> */
public array $missing;
public function __construct(public Booking $booking, public DataRequest $request, public string $kind, public string $url)
{
$this->clarification = $booking->clarificationState();
$this->missing = CaseRequirements::labels($request->fields);
}
public function envelope(): Envelope
{
$subject = $this->request->purpose === RequestCaseData::FOR_BOOKING ? 'Ihre Buchung '.$this->booking->reference : 'Ihre Anfrage '.$this->booking->reference;
return new Envelope(
subject: match ($this->kind) {
DataRequest::REMINDER => 'Erinnerung – '.$subject.': Es fehlen noch Angaben',
DataRequest::FOLLOWUP => $subject.': Noch eine kurze Rückfrage',
default => $subject.': Bitte ergänzen Sie Ihre Angaben',
},
replyTo: [new Address(config('fewo.owner.email'), config('fewo.owner.name'))],
);
}
public function content(): Content
{
return new Content(markdown: 'mail.data-requested');
}
}