domain/reputation.rs
1//! Canonical domain contracts for reputation-review triage.
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/// Source-derived review signal for guest-experience trend and response workflows.
53pub struct Signal {
54 /// Location id fact promoted into this reputation contract.
55 pub location_id: LocationId,
56 /// Platform fact promoted into this reputation contract.
57 pub platform: PlatformName,
58 /// Review id fact promoted into this reputation contract.
59 pub review_id: Id,
60 /// Sentiment fact promoted into this reputation contract.
61 pub sentiment: Sentiment,
62 /// Themes fact promoted into this reputation contract.
63 pub themes: Vec<Theme>,
64 /// Escalation fact promoted into this reputation contract.
65 pub escalation: Escalation,
66}
67
68#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
69/// Domain vocabulary for sentiment decisions in reputation workflows.
70pub enum Sentiment {
71 /// Positive review sentiment, topic, or response action for guest-experience follow-up.
72 Positive,
73 /// Neutral review sentiment, topic, or response action for guest-experience follow-up.
74 Neutral,
75 /// Negative review sentiment, topic, or response action for guest-experience follow-up.
76 Negative,
77 /// Mixed review sentiment, topic, or response action for guest-experience follow-up.
78 Mixed,
79}
80
81#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
82/// Domain vocabulary for theme decisions in reputation workflows.
83pub enum Theme {
84 /// Staff experience review sentiment, topic, or response action for guest-experience follow-up.
85 StaffExperience,
86 /// Cleanliness review sentiment, topic, or response action for guest-experience follow-up.
87 Cleanliness,
88 /// Pricing or billing review sentiment, topic, or response action for guest-experience follow-up.
89 PricingOrBilling,
90 /// Booking experience review sentiment, topic, or response action for guest-experience follow-up.
91 BookingExperience,
92 /// Grooming outcome review sentiment, topic, or response action for guest-experience follow-up.
93 GroomingOutcome,
94 /// Pet injury or safety review sentiment, topic, or response action for guest-experience follow-up.
95 PetInjuryOrSafety,
96 /// Communication review sentiment, topic, or response action for guest-experience follow-up.
97 Communication,
98 /// Wait time review sentiment, topic, or response action for guest-experience follow-up.
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 /// Draft public response review sentiment, topic, or response action for guest-experience follow-up.
110 DraftPublicResponse,
111 /// Manager review required review sentiment, topic, or response action for guest-experience follow-up.
112 ManagerReviewRequired,
113 /// Safety or legal review required review sentiment, topic, or response action for guest-experience follow-up.
114 SafetyOrLegalReviewRequired,
115}