#[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 Event {
    #[serde(rename = "uuid")]
    uuid: conjure_object::Uuid,
    #[serde(rename = "rid")]
    rid: conjure_object::ResourceIdentifier,
    #[builder(default, set(item(type = super::super::scout::rids::api::AssetRid)))]
    #[serde(
        rename = "assetRids",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    asset_rids: std::collections::BTreeSet<super::super::scout::rids::api::AssetRid>,
    #[builder(default, set(item(type = super::EventOrigin)))]
    #[serde(
        rename = "origins",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    origins: std::collections::BTreeSet<super::EventOrigin>,
    #[builder(custom(type = super::super::api::Timestamp, convert = Box::new))]
    #[serde(rename = "timestamp")]
    timestamp: Box<super::super::api::Timestamp>,
    #[builder(
        custom(type = super::super::scout::run::api::Duration, convert = Box::new)
    )]
    #[serde(rename = "duration")]
    duration: Box<super::super::scout::run::api::Duration>,
    #[builder(into)]
    #[serde(rename = "name")]
    name: String,
    #[builder(into)]
    #[serde(rename = "description")]
    description: String,
    #[serde(rename = "type")]
    type_: super::EventType,
    #[builder(default, set(item(type = String, into)))]
    #[serde(
        rename = "labels",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    labels: std::collections::BTreeSet<String>,
    #[builder(default, map(key(type = String, into), value(type = String, into)))]
    #[serde(
        rename = "properties",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    properties: std::collections::BTreeMap<String, String>,
    #[serde(rename = "isArchived")]
    is_archived: bool,
    #[builder(default, into)]
    #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none", default)]
    created_by: Option<super::super::scout::rids::api::UserRid>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::EventDisposition>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "disposition", skip_serializing_if = "Option::is_none", default)]
    disposition: Option<Box<super::EventDisposition>>,
}
impl Event {
    #[deprecated(note = "This field is deprecated. Use the rid field instead.\n")]
    #[inline]
    pub fn uuid(&self) -> conjure_object::Uuid {
        self.uuid
    }
    #[inline]
    pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
        &self.rid
    }
    /// A set of asset rids associated with the event.
    #[inline]
    pub fn asset_rids(
        &self,
    ) -> &std::collections::BTreeSet<super::super::scout::rids::api::AssetRid> {
        &self.asset_rids
    }
    /// A set of origins associated with the event.
    #[inline]
    pub fn origins(&self) -> &std::collections::BTreeSet<super::EventOrigin> {
        &self.origins
    }
    #[inline]
    pub fn timestamp(&self) -> &super::super::api::Timestamp {
        &*self.timestamp
    }
    #[inline]
    pub fn duration(&self) -> &super::super::scout::run::api::Duration {
        &*self.duration
    }
    #[inline]
    pub fn name(&self) -> &str {
        &*self.name
    }
    #[inline]
    pub fn description(&self) -> &str {
        &*self.description
    }
    #[inline]
    pub fn type_(&self) -> &super::EventType {
        &self.type_
    }
    #[inline]
    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
        &self.labels
    }
    #[inline]
    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
        &self.properties
    }
    #[inline]
    pub fn is_archived(&self) -> bool {
        self.is_archived
    }
    /// The user who created the event.
    /// This field may be missing for legacy events.
    #[inline]
    pub fn created_by(&self) -> Option<&super::super::scout::rids::api::UserRid> {
        self.created_by.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn disposition(&self) -> Option<&super::EventDisposition> {
        self.disposition.as_ref().map(|o| &**o)
    }
}
