/// A record of a coachmark dismissal, including when it was dismissed
/// and on which app version.
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct CoachmarkDismissal {
    #[builder(into)]
    #[serde(rename = "coachmarkId")]
    coachmark_id: String,
    #[serde(rename = "dismissedAt")]
    dismissed_at: conjure_object::DateTime<conjure_object::Utc>,
    #[builder(into)]
    #[serde(rename = "appVersion")]
    app_version: String,
    #[builder(default, into)]
    #[serde(rename = "stepIndex", skip_serializing_if = "Option::is_none", default)]
    step_index: Option<i32>,
}
impl CoachmarkDismissal {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        coachmark_id: impl Into<String>,
        dismissed_at: conjure_object::DateTime<conjure_object::Utc>,
        app_version: impl Into<String>,
    ) -> Self {
        Self::builder()
            .coachmark_id(coachmark_id)
            .dismissed_at(dismissed_at)
            .app_version(app_version)
            .build()
    }
    /// The coachmark identifier (typically the feature flag name)
    #[inline]
    pub fn coachmark_id(&self) -> &str {
        &*self.coachmark_id
    }
    /// ISO 8601 timestamp of when the coachmark was dismissed
    #[inline]
    pub fn dismissed_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
        self.dismissed_at
    }
    /// The apps-scout version (semver) when the coachmark was dismissed
    #[inline]
    pub fn app_version(&self) -> &str {
        &*self.app_version
    }
    /// The step index when dismissed (for multi-step coachmarks).
    /// If not present, the coachmark was dismissed via the X button.
    #[inline]
    pub fn step_index(&self) -> Option<i32> {
        self.step_index.as_ref().map(|o| *o)
    }
}
