backbone-activity 0.4.0

Sales activity / touchpoints + rep tasks — the substrate lead/deal sit on
Documentation
//! Public types for Activity module
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! These DTOs are the ONLY types other modules should use.
//! They are decoupled from internal domain entities.

use serde::{Deserialize, Serialize};
use uuid::Uuid;
use chrono::{DateTime, Utc};
use crate::domain::entity::*;

// ============================================================================
// ACTIVITY TYPES
// ============================================================================

/// Type-safe ID for Activity
///
/// Use this instead of raw Uuid for type safety across modules.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ActivityId(pub Uuid);

impl ActivityId {
    pub fn new(id: Uuid) -> Self {
        Self(id)
    }

    pub fn into_inner(self) -> Uuid {
        self.0
    }
}

impl From<Uuid> for ActivityId {
    fn from(id: Uuid) -> Self {
        Self(id)
    }
}

impl From<ActivityId> for Uuid {
    fn from(id: ActivityId) -> Self {
        id.0
    }
}

/// Data transfer object for Activity
///
/// This is the public representation of Activity for other modules.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActivityDto {
    pub id: ActivityId,
    pub subject: String,
    pub activity_type: ActivityType,
    pub direction: Option<ActivityDirection>,
    pub lead_id: Option<Uuid>,
    pub opportunity_id: Option<Uuid>,
    pub party_id: Option<Uuid>,
    pub status: ActivityStatus,
    pub scheduled_at: Option<DateTime<Utc>>,
    pub occurred_at: Option<DateTime<Utc>>,
    pub assignee_id: Option<Uuid>,
    pub outcome: Option<String>,
    pub notes: Option<String>,
    pub metadata: serde_json::Value,
}

/// Summary view of Activity for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActivitySummary {
    pub id: ActivityId,
    pub status: ActivityStatus,
}

/// Reference to Activity for foreign key relationships
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActivityRef {
    pub id: ActivityId,
}

// ============================================================================
// CUSTOM TYPES
// ============================================================================

// Add custom public types here