enbbox 1.0.1

Notification infrastructure API — open-source alternative to Novu/Courier
Documentation
/*
 * enbbox API
 *
 * Notification infrastructure API — open-source alternative to Novu/Courier
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// MessageRecord : A sent message with content, channel, and delivery metadata.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MessageRecord {
    #[serde(rename = "channel")]
    pub channel: String,
    #[serde(rename = "content")]
    pub content: String,
    /// ISO 8601 creation timestamp.
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "data", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub data: Option<Option<serde_json::Value>>,
    /// Unique identifier.
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "is_archived")]
    pub is_archived: bool,
    #[serde(rename = "is_read")]
    pub is_read: bool,
    #[serde(rename = "is_seen")]
    pub is_seen: bool,
    /// Provider identifier.
    #[serde(rename = "provider_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub provider_id: Option<Option<String>>,
    #[serde(rename = "subject", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub subject: Option<Option<String>>,
    /// Subscriber identifier.
    #[serde(rename = "subscriber_id")]
    pub subscriber_id: String,
}

impl MessageRecord {
    /// A sent message with content, channel, and delivery metadata.
    pub fn new(channel: String, content: String, created_at: String, id: String, is_archived: bool, is_read: bool, is_seen: bool, subscriber_id: String) -> MessageRecord {
        MessageRecord {
            channel,
            content,
            created_at,
            data: None,
            id,
            is_archived,
            is_read,
            is_seen,
            provider_id: None,
            subject: None,
            subscriber_id,
        }
    }
}