Skip to main content

mur_common/companion/
mod.rs

1//! Companion subsystem shared types (Phase 1.1).
2
3pub mod content_seed;
4pub mod voice_template;
5
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "snake_case")]
10pub enum Relationship {
11    #[default]
12    Friend,
13    Coach,
14    AccountabilityBuddy,
15    Mentor,
16}
17
18#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
19#[serde(rename_all = "snake_case")]
20pub enum Formality {
21    Casual,
22    #[default]
23    Neutral,
24    Formal,
25}
26
27#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
28#[serde(rename_all = "snake_case")]
29pub enum Situation {
30    MorningGreeting,
31    GentleCheckIn,
32    ShareQuote,
33    ShareLink,
34    WorkflowNudge,
35    /// A schedule the user set fired. Unlike every variant above, this one is
36    /// never chosen by `situations::pick_for_hour` — the picker samples a fixed
37    /// weight table and cannot reach it. It is supplied directly, because both
38    /// questions the picker exists to answer (say something? say what?) were
39    /// already answered by the person who wrote the schedule.
40    Scheduled,
41}
42
43#[cfg(test)]
44mod tests {
45    use super::*;
46
47    #[test]
48    fn workflow_nudge_situation_serializes_snake_case() {
49        assert_eq!(
50            serde_json::to_string(&Situation::WorkflowNudge).unwrap(),
51            "\"workflow_nudge\""
52        );
53        let back: Situation = serde_json::from_str("\"workflow_nudge\"").unwrap();
54        assert_eq!(back, Situation::WorkflowNudge);
55    }
56}
57
58#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
59#[serde(rename_all = "snake_case")]
60pub enum Signal {
61    Positive,
62    Negative,
63    Dismiss,
64    Sent,
65}