Skip to main content

braze_sync/diff/
content_block.rs

1//! Content Block diff types.
2
3use crate::diff::DiffOp;
4use crate::resource::ContentBlock;
5
6#[derive(Debug, Clone)]
7pub struct ContentBlockDiff {
8    pub name: String,
9    pub op: DiffOp<ContentBlock>,
10    pub text_diff: Option<TextDiffSummary>,
11    /// True when present in Braze but missing from Git. See ยง11.6.
12    pub orphan: bool,
13}
14
15#[derive(Debug, Clone)]
16pub struct TextDiffSummary {
17    pub additions: usize,
18    pub deletions: usize,
19    pub unified_hunks: Vec<String>,
20}
21
22impl ContentBlockDiff {
23    pub fn has_changes(&self) -> bool {
24        self.op.is_change() || self.orphan
25    }
26
27    pub fn is_orphan(&self) -> bool {
28        self.orphan
29    }
30}