domain/temperament.rs
1//! Temperament and behavior-observation contracts for daycare and care safety.
2//!
3//! These values promote staff/source notes into validated, redacted domain signals before
4//! they influence group-play eligibility, daily-brief watchlists, staffing plans, or
5//! customer communication. Review evidence remains explicit so automation supports staff
6//! judgment instead of overriding safety policy.
7
8use nutype::nutype;
9use serde::{Deserialize, Serialize};
10use std::fmt;
11
12#[nutype(
13 sanitize(trim),
14 validate(not_empty, len_char_max = 1000),
15 derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)
16)]
17/// Redacted staff note containing temperament evidence for review workflows.
18pub struct StaffNote(String);
19
20#[nutype(
21 sanitize(trim),
22 validate(not_empty, len_char_max = 80),
23 derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)
24)]
25/// Provider-specific behavior label retained when no first-class variant exists.
26pub struct BehaviorObservationLabel(String);
27
28impl fmt::Debug for StaffNote {
29 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
30 formatter.write_str("StaffNote(<redacted>)")
31 }
32}
33
34impl fmt::Debug for BehaviorObservationLabel {
35 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
36 formatter.write_str("BehaviorObservationLabel(<redacted>)")
37 }
38}
39
40#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
41/// Domain vocabulary for group play observation decisions in temperament workflows.
42pub enum GroupPlayObservation {
43 #[default]
44 /// Not yet observed temperament signal for playgroup and handling decisions.
45 NotYetObserved,
46 /// Comfortable in observed group temperament signal for playgroup and handling decisions.
47 ComfortableInObservedGroup,
48 /// Stressed in group setting temperament signal for playgroup and handling decisions.
49 StressedInGroupSetting,
50 /// Needs intro assessment temperament signal for playgroup and handling decisions.
51 NeedsIntroAssessment,
52}
53
54impl GroupPlayObservation {
55 /// Returns whether group-play status requires staff evaluation before assignment.
56 pub fn needs_staff_evaluation(self) -> bool {
57 matches!(self, Self::NeedsIntroAssessment)
58 }
59}
60
61#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
62/// Domain vocabulary for people orientation decisions in temperament workflows.
63pub enum PeopleOrientation {
64 /// People seeking temperament signal for playgroup and handling decisions.
65 PeopleSeeking,
66 /// Neutral temperament signal for playgroup and handling decisions.
67 Neutral,
68 /// People avoidant temperament signal for playgroup and handling decisions.
69 PeopleAvoidant,
70 #[default]
71 /// Provider role or status could not be mapped confidently.
72 Unknown,
73}
74
75#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
76/// Domain vocabulary for rating decisions in temperament workflows.
77pub enum Rating {
78 /// Easygoing temperament signal for playgroup and handling decisions.
79 Easygoing,
80 /// Moderate temperament signal for playgroup and handling decisions.
81 Moderate,
82 /// Needs structure temperament signal for playgroup and handling decisions.
83 NeedsStructure,
84 /// Review required temperament signal for playgroup and handling decisions.
85 ReviewRequired,
86 #[default]
87 /// Provider role or status could not be mapped confidently.
88 Unknown,
89}
90
91#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
92/// Domain vocabulary for behavior observation decisions in temperament workflows.
93pub enum BehaviorObservation {
94 /// Anxiety temperament signal for playgroup and handling decisions.
95 Anxiety,
96 /// Bite history temperament signal for playgroup and handling decisions.
97 BiteHistory,
98 /// Dog selective temperament signal for playgroup and handling decisions.
99 DogSelective,
100 /// Human selective temperament signal for playgroup and handling decisions.
101 HumanSelective,
102 /// Escape risk temperament signal for playgroup and handling decisions.
103 EscapeRisk,
104 /// Food guarding temperament signal for playgroup and handling decisions.
105 FoodGuarding,
106 /// Requires manager review temperament signal for playgroup and handling decisions.
107 RequiresManagerReview,
108 /// Extension point for provider-specific values not modeled directly.
109 Extension(BehaviorObservationLabel),
110}
111
112impl BehaviorObservation {
113 /// Returns whether the observation should create behavior-review evidence.
114 pub fn indicates_behavior_review_evidence(&self) -> bool {
115 matches!(
116 self,
117 Self::BiteHistory | Self::RequiresManagerReview | Self::HumanSelective
118 )
119 }
120}