Files
fewo-stommer/app/Process/Modules/Stay/ArrivalInformation.php
T

53 lines
2.3 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\Process\Modules\Stay;
use App\Enums\ActivityState;
use App\Enums\Execution;
use App\Enums\ProcessSetting;
use App\Enums\Responsibility;
use App\Process\Activity;
use App\Process\CaseContext;
use App\Process\Modules\Module;
use App\Process\Modules\ModuleDefinition;
/**
* P04: the arrival information for the guest – sent by us (SendBookingReminders) or announced by the portal. Who sends
* it is variable within the model (supplementary, not contract documentation; decision O1).
*/
final class ArrivalInformation extends Module
{
public static function key(): string
{
return 'arrival.info';
}
public static function definition(): ModuleDefinition
{
return new ModuleDefinition(
label: 'Anreise-Informationen',
purpose: 'Wegbeschreibung, Schlüssel und Kontakt vor Ort rechtzeitig vor der Anreise.',
phase: 'P04',
why: 'Ohne Anreise-Informationen finden Gäste Schlüssel und Wohnung nicht; wer sie sendet, ist einstellbar.',
executions: [Execution::Automatic, Execution::Portal, Execution::ServiceProvider, Execution::NotRequired],
condition: 'bei verbindlichen Buchungen',
effects: ['guest_mail'],
waits: ['time', 'portal'],
triggers: ['schedule:reminders'],
parameters: [ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoDaysBefore],
performers: ['system', 'portal', 'service_provider'],
events: ['document', 'mail'],
);
}
public function activities(CaseContext $case): array
{
$booking = $case->booking;
$profile = $case->profile;
return [$profile->guestMessages() === Responsibility::Portal
? new Activity('arrival_info', 'Anreise-Informationen an den Gast', ActivityState::External, 'durch '.($booking->processChannel()?->name ?? 'das Portal').' (angekündigt) – eine Zustellung ist damit nicht nachgewiesen')
: new Activity('arrival_info', 'Anreise-Informationen an den Gast (automatisch)', $case->later($booking->arrival_info_sent_at !== null ? ActivityState::Done : ActivityState::Later), $booking->arrival_info_sent_at ? 'gesendet am '.$booking->arrival_info_sent_at->format('d.m.Y') : $profile->arrivalInfoDaysBefore().' Tage vor Anreise')];
}
}