backbone-digest 0.3.0

KPI digests — the periodic KPI-email engine: a declarative name-keyed KPI registry other modules extend, per-recipient fenced rendering with declared (never row-count) KPI drops, the anti-spam slowdown ladder, a shared tips carousel, and a daily plain-pull cron whose due-date column is the queue (Odoo digest port)
//! Public types for Digest 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, NaiveDate};
use crate::domain::entity::*;

// ============================================================================
// DIGESTDIGEST TYPES
// ============================================================================

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

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

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

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

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

/// Data transfer object for DigestDigest
///
/// This is the public representation of DigestDigest for other modules.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestDigestDto {
    pub id: DigestDigestId,
    pub name: String,
    pub periodicity: DigestPeriodicity,
    pub next_run_date: Option<NaiveDate>,
    pub state: DigestState,
    pub metadata: serde_json::Value,
}

/// Summary view of DigestDigest for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestDigestSummary {
    pub id: DigestDigestId,
    pub name: String,
}

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

// ============================================================================
// DIGESTSUBSCRIPTION TYPES
// ============================================================================

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

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

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

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

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

/// Data transfer object for DigestSubscription
///
/// This is the public representation of DigestSubscription for other modules.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestSubscriptionDto {
    pub id: DigestSubscriptionId,
    pub digest_id: Uuid,
    pub user_id: Uuid,
    pub state: DigestSubscriptionState,
    pub unsubscribed_at: Option<DateTime<Utc>>,
    pub metadata: serde_json::Value,
}

/// Summary view of DigestSubscription for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestSubscriptionSummary {
    pub id: DigestSubscriptionId,
}

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

// ============================================================================
// DIGESTDIGESTKPI TYPES
// ============================================================================

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

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

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

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

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

/// Data transfer object for DigestDigestKpi
///
/// This is the public representation of DigestDigestKpi for other modules.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestDigestKpiDto {
    pub id: DigestDigestKpiId,
    pub digest_id: Uuid,
    pub kpi_key: String,
    pub metadata: serde_json::Value,
}

/// Summary view of DigestDigestKpi for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestDigestKpiSummary {
    pub id: DigestDigestKpiId,
}

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

// ============================================================================
// DIGESTTIP TYPES
// ============================================================================

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

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

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

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

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

/// Data transfer object for DigestTip
///
/// This is the public representation of DigestTip for other modules.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestTipDto {
    pub id: DigestTipId,
    pub sequence: i32,
    pub name: String,
    pub tip_description: String,
    pub group_key: Option<String>,
    pub metadata: serde_json::Value,
}

/// Summary view of DigestTip for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestTipSummary {
    pub id: DigestTipId,
    pub name: String,
}

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

// ============================================================================
// DIGESTTIPUSER TYPES
// ============================================================================

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

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

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

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

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

/// Data transfer object for DigestTipUser
///
/// This is the public representation of DigestTipUser for other modules.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestTipUserDto {
    pub id: DigestTipUserId,
    pub tip_id: Uuid,
    pub user_id: Uuid,
    pub metadata: serde_json::Value,
}

/// Summary view of DigestTipUser for list displays
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DigestTipUserSummary {
    pub id: DigestTipUserId,
}

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

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

// <<< CUSTOM TYPES START >>>
// Add custom public types here
// <<< CUSTOM TYPES END >>>