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

/// CreateWorkflow : Create a multi-step notification workflow. Each step sends through a specific channel (email, SMS, push, etc.).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateWorkflow {
    /// Whether the workflow is active. Inactive workflows ignore triggers.
    #[serde(rename = "active", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub active: Option<Option<bool>>,
    /// Whether notifications from this workflow are critical (bypass subscriber preferences).
    #[serde(rename = "critical", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub critical: Option<Option<bool>>,
    /// Optional description of what this workflow does.
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    /// Human-readable workflow name.
    #[serde(rename = "name")]
    pub name: String,
    /// Notification group this workflow belongs to.
    #[serde(rename = "notification_group_id")]
    pub notification_group_id: uuid::Uuid,
    /// Per-channel preference overrides for this workflow.
    #[serde(rename = "preference_settings", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub preference_settings: Option<Option<models::PreferenceChannels>>,
    /// Ordered list of workflow steps.
    #[serde(rename = "steps")]
    pub steps: Vec<models::WorkflowStepCreate>,
    /// Tags for organizing and filtering workflows.
    #[serde(rename = "tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Option<Vec<String>>>,
}

impl CreateWorkflow {
    /// Create a multi-step notification workflow. Each step sends through a specific channel (email, SMS, push, etc.).
    pub fn new(name: String, notification_group_id: uuid::Uuid, steps: Vec<models::WorkflowStepCreate>) -> CreateWorkflow {
        CreateWorkflow {
            active: None,
            critical: None,
            description: None,
            name,
            notification_group_id,
            preference_settings: None,
            steps,
            tags: None,
        }
    }
}