Skip to main content

domain/
reputation.rs

1//! Reputation-review triage for customer-trust, safety-theme, and response workflows.
2//!
3//! Review signals and escalation decisions cut across service lines. A provider
4//! review becomes a validated reputation signal, then drives manager/reputation
5//! workflow only through explicit escalation states so customer-facing responses,
6//! injury/safety themes, and legal-sensitive cases stay human-gated.
7
8use nutype::nutype;
9#[allow(unused_imports)]
10use serde::{Deserialize, Serialize};
11
12use crate::entities::LocationId;
13use crate::operations;
14
15#[nutype(
16    sanitize(trim),
17    validate(not_empty, len_char_max = 120),
18    derive(
19        Debug,
20        Clone,
21        PartialEq,
22        Eq,
23        PartialOrd,
24        Ord,
25        Hash,
26        Serialize,
27        Deserialize
28    )
29)]
30/// Validated external review platform name used as reputation-source evidence.
31pub struct PlatformName(String);
32
33#[nutype(
34    sanitize(trim),
35    validate(not_empty, len_char_max = 160),
36    derive(
37        Debug,
38        Clone,
39        PartialEq,
40        Eq,
41        PartialOrd,
42        Ord,
43        Hash,
44        Serialize,
45        Deserialize
46    )
47)]
48/// Stable provider review id retained for traceability and deduplication.
49pub struct Id(String);
50
51#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
52/// Review signal that preserves platform evidence for manager triage and response drafting.
53pub struct Signal {
54    /// Resort location connected to the review or escalation.
55    pub location_id: LocationId,
56    /// External review platform where staff can verify the source post.
57    pub platform: PlatformName,
58    /// Provider review id retained for traceability and duplicate checks.
59    pub review_id: Id,
60    /// Sentiment classification used to rank manager or reputation follow-up.
61    pub sentiment: Sentiment,
62    /// Topics staff should review before drafting or routing a response.
63    pub themes: Vec<Theme>,
64    /// Required review path before customer-facing response or legal-sensitive handling.
65    pub escalation: Escalation,
66}
67
68#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
69/// Review sentiment used to triage service recovery and reputation follow-up.
70pub enum Sentiment {
71    /// Positive sentiment that may feed recognition, marketing, or low-risk thank-you drafting.
72    Positive,
73    /// Neutral sentiment that may need monitoring but not automatic escalation by itself.
74    Neutral,
75    /// Negative sentiment that should trigger service-recovery review before any public response.
76    Negative,
77    /// Mixed sentiment with both praise and concerns, requiring staff interpretation before response.
78    Mixed,
79}
80
81#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
82/// Review theme that links customer feedback to service, staffing, facility, or pricing evidence.
83pub enum Theme {
84    /// Feedback about staff interactions that should be verified against service context before response.
85    StaffExperience,
86    /// Cleanliness theme that may connect to facility checks or manager follow-up.
87    Cleanliness,
88    /// Pricing or billing theme requiring invoice/payment evidence before customer response.
89    PricingOrBilling,
90    /// Booking-experience theme tied to availability, scheduling, or intake workflow evidence.
91    BookingExperience,
92    /// Grooming-outcome theme requiring service evidence before apology, refund, or corrective promises.
93    GroomingOutcome,
94    /// Pet injury or safety theme that must route through manager/safety review before public reply.
95    PetInjuryOrSafety,
96    /// Communication theme that can point to missed messages, unclear updates, or follow-up gaps.
97    Communication,
98    /// Wait-time theme that may need staffing, front-desk, or scheduling evidence.
99    WaitTime,
100    /// Non-dog, non-cat pet handled by exception policy.
101    Other(operations::operational::Observation),
102}
103
104#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
105/// Review-response gate that decides whether automation may draft or must escalate.
106pub enum Escalation {
107    /// No additional workflow gate is required.
108    None,
109    /// A public response may be drafted, but staff must verify service evidence before approval.
110    DraftPublicResponse,
111    /// Manager must review the signal before customer-facing or operational follow-up proceeds.
112    ManagerReviewRequired,
113    /// Safety/legal-sensitive signal blocks public response until authorized review approves wording.
114    SafetyOrLegalReviewRequired,
115}