Skip to main content

braze_sync/diff/
custom_attribute.rs

1//! Custom Attribute diff types.
2//!
3//! The only mutation `apply` can perform is the deprecation flag toggle.
4
5#[derive(Debug, Clone)]
6pub struct CustomAttributeDiff {
7    pub name: String,
8    pub op: CustomAttributeOp,
9}
10
11#[derive(Debug, Clone)]
12pub enum CustomAttributeOp {
13    /// Present in Braze but missing from local registry. Action: prompt `export`.
14    UnregisteredInGit,
15    /// Present in local registry but not in Braze. Often a typo.
16    PresentInGitOnly,
17    /// `deprecated` flag changed. The only mutation `apply` actually performs.
18    DeprecationToggled {
19        from: bool,
20        to: bool,
21    },
22    /// Only the description changed. No API to update it, so `apply` is a no-op.
23    MetadataOnly,
24    Unchanged,
25}
26
27impl CustomAttributeDiff {
28    pub fn has_changes(&self) -> bool {
29        !matches!(self.op, CustomAttributeOp::Unchanged)
30    }
31}