domain/temperament.rs
1//! Temperament and behavior-observation contracts for daycare and care safety.
2//!
3//! ## Operator-summary
4//!
5//! This module supports behavior-review and play-assignment queues by naming group-play
6//! observations, people orientation, overall rating, and specific behavior evidence such
7//! as bite history, human selectivity, escape risk, or food guarding. It can reduce labor
8//! by turning staff/provider notes into a consistent watchlist for daycare eligibility,
9//! staffing plans, daily briefs, and customer-safe follow-up drafts.
10//!
11//! It must not automate live group assignment, behavior determinations, training advice,
12//! customer blame, or safety exceptions. Authoritative facts remain the reviewed staff
13//! observations, source notes, incident history, location play policy, and approval records;
14//! these values only preserve redacted signals for downstream review. Review gates protect
15//! pets, customers, and staff by routing stale, missing, manager-review, bite-history, or
16//! selectivity evidence to behavior/manager review before it changes play access or
17//! customer-visible messaging.
18//!
19//! These values promote staff/source notes into validated, redacted domain signals before
20//! they influence group-play eligibility, daily-brief watchlists, staffing plans, or
21//! customer communication. Review evidence remains explicit so automation supports staff
22//! judgment instead of overriding safety policy.
23
24use nutype::nutype;
25use serde::{Deserialize, Serialize};
26use std::fmt;
27
28#[nutype(
29 sanitize(trim),
30 validate(not_empty, len_char_max = 1000),
31 derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)
32)]
33/// Redacted staff note containing temperament evidence for review workflows.
34pub struct StaffNote(String);
35
36#[nutype(
37 sanitize(trim),
38 validate(not_empty, len_char_max = 80),
39 derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)
40)]
41/// Provider-specific behavior label retained when no first-class variant exists.
42pub struct BehaviorObservationLabel(String);
43
44impl fmt::Debug for StaffNote {
45 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
46 formatter.write_str("StaffNote(<redacted>)")
47 }
48}
49
50impl fmt::Debug for BehaviorObservationLabel {
51 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
52 formatter.write_str("BehaviorObservationLabel(<redacted>)")
53 }
54}
55
56#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
57/// Reviewed group-play status that gates daycare assignment and intro-assessment work.
58pub enum GroupPlayObservation {
59 #[default]
60 /// No reviewed group-play observation exists yet, so staff need fresh behavior evidence before assignment.
61 NotYetObserved,
62 /// Staff have observed comfortable group play, supporting normal playgroup consideration.
63 ComfortableInObservedGroup,
64 /// Group setting caused stress, so care staff should consider quieter handling or alternate placement.
65 StressedInGroupSetting,
66 /// Pet needs an intro assessment before group play can be offered or promised.
67 NeedsIntroAssessment,
68}
69
70impl GroupPlayObservation {
71 /// Returns whether group-play status requires staff evaluation before assignment.
72 pub fn needs_staff_evaluation(self) -> bool {
73 matches!(self, Self::NeedsIntroAssessment)
74 }
75}
76
77#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
78/// Staff-observed people orientation used to plan handling, staffing, and customer follow-up.
79pub enum PeopleOrientation {
80 /// Pet actively seeks human interaction, which helps staff plan handling and enrichment.
81 PeopleSeeking,
82 /// Pet shows no strong people-seeking or avoidant signal in reviewed notes.
83 Neutral,
84 /// Pet avoids people, so staff should use slower handling and review before customer-facing assurances.
85 PeopleAvoidant,
86 #[default]
87 /// People-orientation evidence is missing or unclear and should not drive handling policy by itself.
88 Unknown,
89}
90
91#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
92/// Overall temperament rating used to rank play eligibility and behavior-review attention.
93pub enum Rating {
94 /// Reviewed temperament is easygoing enough for normal handling unless other watchlist evidence exists.
95 Easygoing,
96 /// Temperament needs ordinary staff awareness but does not by itself block care workflows.
97 Moderate,
98 /// Pet benefits from structured handling or play rules that staff should review before assignment.
99 NeedsStructure,
100 /// Temperament evidence requires behavior or manager review before it changes play access.
101 ReviewRequired,
102 #[default]
103 /// People-orientation evidence is missing or unclear and should not drive handling policy by itself.
104 Unknown,
105}
106
107#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
108/// Specific behavior evidence that can block play access or require manager review.
109pub enum BehaviorObservation {
110 /// Anxiety observed in source notes, signaling care attention and possible lower-stimulation handling.
111 Anxiety,
112 /// Bite history is safety-sensitive evidence that must route to behavior/manager review.
113 BiteHistory,
114 /// Dog-selective behavior means group pairing needs staff judgment instead of automatic assignment.
115 DogSelective,
116 /// Human-selective behavior affects handling plans and should create review evidence.
117 HumanSelective,
118 /// Escape-risk evidence alerts staff to containment and handoff precautions.
119 EscapeRisk,
120 /// Food-guarding evidence affects feeding, enrichment, and group-care supervision.
121 FoodGuarding,
122 /// Source notes explicitly require manager review before changing access or messaging.
123 RequiresManagerReview,
124 /// Extension point for provider-specific values not modeled directly.
125 Extension(BehaviorObservationLabel),
126}
127
128impl BehaviorObservation {
129 /// Returns whether the observation should create behavior-review evidence.
130 pub fn indicates_behavior_review_evidence(&self) -> bool {
131 matches!(
132 self,
133 Self::BiteHistory | Self::RequiresManagerReview | Self::HumanSelective
134 )
135 }
136}