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};

/// ActivityRecord : An activity log entry recording one execution step of a notification delivery.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ActivityRecord {
    /// Delivery channel (email, sms, push, chat, in_app).
    #[serde(rename = "channel", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub channel: Option<Option<String>>,
    /// ISO 8601 timestamp when this activity was recorded.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// Human-readable detail of this execution step.
    #[serde(rename = "detail")]
    pub detail: String,
    /// Execution detail UUID.
    #[serde(rename = "id")]
    pub id: String,
    /// Integration UUID — the specific integration instance used.
    #[serde(rename = "integration_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub integration_id: Option<Option<String>>,
    /// User-given integration label (e.g. \"telegram-1\", \"my-sendgrid\").
    #[serde(rename = "integration_identifier", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub integration_identifier: Option<Option<String>>,
    /// Whether this was an automatic retry.
    #[serde(rename = "is_retry")]
    pub is_retry: bool,
    /// Whether this was a test-mode execution.
    #[serde(rename = "is_test")]
    pub is_test: bool,
    /// Parent job UUID.
    #[serde(rename = "job_id")]
    pub job_id: String,
    /// Parent notification UUID.
    #[serde(rename = "notification_id")]
    pub notification_id: String,
    /// Provider type that handled delivery (e.g. \"telegram\", \"sendgrid\").
    #[serde(rename = "provider_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub provider_id: Option<Option<String>>,
    /// Originating source: `api`, `worker`, `webhook`.
    #[serde(rename = "source")]
    pub source: String,
    /// Execution status: `success`, `failed`, `pending`.
    #[serde(rename = "status")]
    pub status: String,
    /// Subscriber who received this notification.
    #[serde(rename = "subscriber_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub subscriber_id: Option<Option<String>>,
    /// Transaction ID for idempotency/tracing.
    #[serde(rename = "transaction_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub transaction_id: Option<Option<String>>,
    /// Workflow UUID that produced this activity.
    #[serde(rename = "workflow_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub workflow_id: Option<Option<String>>,
}

impl ActivityRecord {
    /// An activity log entry recording one execution step of a notification delivery.
    pub fn new(created_at: String, detail: String, id: String, is_retry: bool, is_test: bool, job_id: String, notification_id: String, source: String, status: String) -> ActivityRecord {
        ActivityRecord {
            channel: None,
            created_at,
            detail,
            id,
            integration_id: None,
            integration_identifier: None,
            is_retry,
            is_test,
            job_id,
            notification_id,
            provider_id: None,
            source,
            status,
            subscriber_id: None,
            transaction_id: None,
            workflow_id: None,
        }
    }
}