- Kleines Modell (claude-haiku-5-5) extrahiert Fakten mit Belegstelle und Konfidenz; programmatische Prüfung (Gültigkeit, Belegstelle im Original, Widerspruch zum gespeicherten Wert oder in der Nachricht, Plausibilität, Kritikalität nach Feld und Phase). Widerspruch oder fehlgeschlagene Prüfung → Prüfmodell (claude-opus-5-5, serverseitiger Fallback bei Ablehnung) unabhängig von der Konfidenz; solche Fakten nie automatisch. - Nur geprüfte, bisher fehlende Angaben gehen an den Fakteneingang (Quelle „llm“); Zeitraum/Personen nur als Änderungswunsch (M06); Rest als Vorschlag im Posteingang („Vorschläge übernehmen“). - Versionierte Prompts mit Platzhaltern, JSON-Schema mit eigener Validierung und einer Wiederholung; Ausfall/Ablehnung → sicherer Rückfall zur Vermieterin. HTTP-Client, kein SDK (laut Plan). - Dienst „KI: Gästekommunikation“ verdrahtet, standardmäßig aus; Schlüssel je Mandant oder FEWO_AI_API_KEY; Verbrauch in service_usages. - messages:extract alle fünf Minuten; ai:evaluate misst Fehlwerte und übersehene Angaben getrennt (M05). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
2.8 KiB
PHP
79 lines
2.8 KiB
PHP
<?php
|
||
|
||
namespace App\Enums;
|
||
|
||
/**
|
||
* Services the operator unlocks per landlord. `isWired()` says whether the application really asks before
|
||
* it acts – a service that nothing asks for must not be offered as a switch, because switching it would
|
||
* promise something that does not happen.
|
||
*/
|
||
enum TenantServiceKey: string
|
||
{
|
||
case PortalSync = 'portal_sync';
|
||
case PortalMail = 'portal_mail';
|
||
case AiOffers = 'ai_offers';
|
||
case AiMarketing = 'ai_marketing';
|
||
case AiGuestMail = 'ai_guest_mail';
|
||
|
||
public function label(): string
|
||
{
|
||
return match ($this) {
|
||
self::PortalSync => 'Portal-Abgleich (iCal)',
|
||
self::PortalMail => 'Portal-Postfach (Schnellweg)',
|
||
self::AiOffers => 'KI: Angebotsentwürfe',
|
||
self::AiMarketing => 'KI: Vermarktungsassistent',
|
||
self::AiGuestMail => 'KI: Gästekommunikation',
|
||
};
|
||
}
|
||
|
||
public function description(): string
|
||
{
|
||
return match ($this) {
|
||
self::PortalSync => 'Belegungen der Portale über iCal einlesen und den eigenen Kalender als Feed anbieten.',
|
||
self::PortalMail => 'Buchungsmails der Portale aus dem Postfach lesen und Termine sofort sperren.',
|
||
self::AiGuestMail => 'Antworten und Nachrichten der Gäste auswerten: erkannte Angaben (Anschrift, Telefon …) werden vorgeschlagen und nur nach festen Regeln übernommen; nichts Verbindliches entscheidet die KI.',
|
||
self::AiOffers, self::AiMarketing => 'Noch nicht gebaut.',
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Whether the application asks this switch before it acts. Only wired services are offered for switching.
|
||
*/
|
||
public function isWired(): bool
|
||
{
|
||
return match ($this) {
|
||
self::PortalSync, self::PortalMail, self::AiGuestMail => true,
|
||
self::AiOffers, self::AiMarketing => false,
|
||
};
|
||
}
|
||
|
||
/**
|
||
* What applies to a landlord the operator has not decided about yet. The portal services were part of
|
||
* the product before there were landlords, so switching tenancy on must not silently stop them.
|
||
*/
|
||
public function enabledByDefault(): bool
|
||
{
|
||
// The AI service sends guests' messages to an external provider: only after the operator switched it on.
|
||
return $this->isWired() && $this !== self::AiGuestMail;
|
||
}
|
||
|
||
/**
|
||
* Whether the landlord's own API key is of any use (the guest communication extraction calls out).
|
||
*/
|
||
public function usesApiKey(): bool
|
||
{
|
||
return match ($this) {
|
||
self::AiOffers, self::AiMarketing, self::AiGuestMail => true,
|
||
self::PortalSync, self::PortalMail => false,
|
||
};
|
||
}
|
||
|
||
/**
|
||
* @return list<self>
|
||
*/
|
||
public static function wired(): array
|
||
{
|
||
return array_values(array_filter(self::cases(), fn (self $service): bool => $service->isWired()));
|
||
}
|
||
}
|