remem/workstream/
types.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4#[serde(rename_all = "lowercase")]
5pub enum WorkStreamStatus {
6 Active,
7 Paused,
8 Completed,
9 Abandoned,
10}
11
12impl WorkStreamStatus {
13 pub fn as_str(&self) -> &'static str {
14 match self {
15 Self::Active => "active",
16 Self::Paused => "paused",
17 Self::Completed => "completed",
18 Self::Abandoned => "abandoned",
19 }
20 }
21
22 pub fn from_db(s: &str) -> Self {
23 match s {
24 "paused" => Self::Paused,
25 "completed" => Self::Completed,
26 "abandoned" => Self::Abandoned,
27 _ => Self::Active,
28 }
29 }
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct WorkStream {
34 pub id: i64,
35 pub project: String,
36 pub title: String,
37 pub description: Option<String>,
38 pub status: WorkStreamStatus,
39 pub progress: Option<String>,
40 pub next_action: Option<String>,
41 pub blockers: Option<String>,
42 pub created_at_epoch: i64,
43 pub updated_at_epoch: i64,
44 pub completed_at_epoch: Option<i64>,
45 #[serde(default)]
46 pub mmdd: Option<String>,
47 #[serde(default)]
48 pub session_intent: Option<String>,
49 #[serde(default)]
50 pub session_topic: Option<String>,
51 #[serde(default)]
52 pub display_label: Option<String>,
53 #[serde(default)]
54 pub session_intent_source: Option<String>,
55}
56
57#[derive(Debug, Clone)]
58pub struct ParsedWorkStream {
59 pub title: Option<String>,
60 pub progress: Option<String>,
61 pub next_action: Option<String>,
62 pub blockers: Option<String>,
63 pub is_completed: bool,
64}
65
66#[derive(Debug, Clone, PartialEq, Eq)]
67pub struct WorkStreamUpsertResult {
68 pub id: i64,
69 pub match_reason: &'static str,
70}
71
72#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
73pub struct WorkStreamMergeResult {
74 pub canonical_id: i64,
75 pub merged_ids: Vec<i64>,
76 pub moved_session_links: usize,
77 pub copied_aliases: usize,
78 pub copied_alias_sources: usize,
79}