Skip to main content

braze_sync/diff/
email_template.rs

1//! Email Template diff types.
2
3use crate::diff::content_block::TextDiffSummary;
4use crate::diff::DiffOp;
5
6#[derive(Debug, Clone)]
7pub struct EmailTemplateDiff {
8    pub name: String,
9    // TODO(phase-b): change to DiffOp<EmailTemplate> for symmetry with
10    // CatalogSchemaDiff — natural to refactor when B2 implements this resource.
11    pub op: DiffOp<()>,
12    pub subject_changed: bool,
13    pub body_html_diff: Option<TextDiffSummary>,
14    pub body_plaintext_diff: Option<TextDiffSummary>,
15    pub metadata_changed: bool,
16    pub orphan: bool,
17}
18
19impl EmailTemplateDiff {
20    pub fn has_changes(&self) -> bool {
21        self.op.is_change()
22            || self.subject_changed
23            || self.body_html_diff.is_some()
24            || self.body_plaintext_diff.is_some()
25            || self.metadata_changed
26            || self.orphan
27    }
28
29    pub fn is_orphan(&self) -> bool {
30        self.orphan
31    }
32}