Skip to main content

backbone_activity/exports/
types.rs

1//! Public types for Activity module
2//!
3//! Generated by metaphor-schema. Do not edit manually.
4//!
5//! These DTOs are the ONLY types other modules should use.
6//! They are decoupled from internal domain entities.
7
8use serde::{Deserialize, Serialize};
9use uuid::Uuid;
10use chrono::{DateTime, Utc};
11use crate::domain::entity::*;
12
13// ============================================================================
14// ACTIVITY TYPES
15// ============================================================================
16
17/// Type-safe ID for Activity
18///
19/// Use this instead of raw Uuid for type safety across modules.
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
21pub struct ActivityId(pub Uuid);
22
23impl ActivityId {
24    pub fn new(id: Uuid) -> Self {
25        Self(id)
26    }
27
28    pub fn into_inner(self) -> Uuid {
29        self.0
30    }
31}
32
33impl From<Uuid> for ActivityId {
34    fn from(id: Uuid) -> Self {
35        Self(id)
36    }
37}
38
39impl From<ActivityId> for Uuid {
40    fn from(id: ActivityId) -> Self {
41        id.0
42    }
43}
44
45/// Data transfer object for Activity
46///
47/// This is the public representation of Activity for other modules.
48#[derive(Debug, Clone, Serialize, Deserialize)]
49pub struct ActivityDto {
50    pub id: ActivityId,
51    pub subject: String,
52    pub activity_type: ActivityType,
53    pub direction: Option<ActivityDirection>,
54    pub lead_id: Option<Uuid>,
55    pub opportunity_id: Option<Uuid>,
56    pub party_id: Option<Uuid>,
57    pub status: ActivityStatus,
58    pub scheduled_at: Option<DateTime<Utc>>,
59    pub occurred_at: Option<DateTime<Utc>>,
60    pub assignee_id: Option<Uuid>,
61    pub outcome: Option<String>,
62    pub notes: Option<String>,
63    pub metadata: serde_json::Value,
64}
65
66/// Summary view of Activity for list displays
67#[derive(Debug, Clone, Serialize, Deserialize)]
68pub struct ActivitySummary {
69    pub id: ActivityId,
70    pub status: ActivityStatus,
71}
72
73/// Reference to Activity for foreign key relationships
74#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct ActivityRef {
76    pub id: ActivityId,
77}
78
79// ============================================================================
80// CUSTOM TYPES
81// ============================================================================
82
83// <<< CUSTOM TYPES START >>>
84// Add custom public types here
85// <<< CUSTOM TYPES END >>>