#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct Dataset {
    #[serde(rename = "rid")]
    rid: conjure_object::ResourceIdentifier,
    #[builder(into)]
    #[serde(rename = "name")]
    name: String,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::Handle>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "handle", skip_serializing_if = "Option::is_none", default)]
    handle: Option<Box<super::Handle>>,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(custom(type = super::DatasetOriginMetadata, convert = Box::new))]
    #[serde(rename = "originMetadata")]
    origin_metadata: Box<super::DatasetOriginMetadata>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::Bounds>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "bounds", skip_serializing_if = "Option::is_none", default)]
    bounds: Option<Box<super::Bounds>>,
    #[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>,
    #[builder(default, set(item(type = String, into)))]
    #[serde(
        rename = "labels",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    labels: std::collections::BTreeSet<String>,
    #[serde(rename = "timestampType")]
    timestamp_type: super::WeakTimestampType,
    #[serde(rename = "allowStreaming")]
    allow_streaming: bool,
    #[serde(rename = "granularity")]
    granularity: super::super::super::api::Granularity,
    #[serde(rename = "isArchived")]
    is_archived: bool,
    #[builder(default, into)]
    #[serde(rename = "datasetType", skip_serializing_if = "Option::is_none", default)]
    dataset_type: Option<super::DatasetBackingType>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::DerivedDefinition>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "derivedDefinition",
        skip_serializing_if = "Option::is_none",
        default
    )]
    derived_definition: Option<Box<super::DerivedDefinition>>,
}
impl Dataset {
    #[inline]
    pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
        &self.rid
    }
    #[inline]
    pub fn name(&self) -> &str {
        &*self.name
    }
    #[deprecated(note = "Deprecated. Use DatasetFile#handle")]
    #[inline]
    pub fn handle(&self) -> Option<&super::Handle> {
        self.handle.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn origin_metadata(&self) -> &super::DatasetOriginMetadata {
        &*self.origin_metadata
    }
    #[inline]
    pub fn bounds(&self) -> Option<&super::Bounds> {
        self.bounds.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
        &self.properties
    }
    #[inline]
    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
        &self.labels
    }
    #[inline]
    pub fn timestamp_type(&self) -> &super::WeakTimestampType {
        &self.timestamp_type
    }
    #[inline]
    pub fn allow_streaming(&self) -> bool {
        self.allow_streaming
    }
    #[inline]
    pub fn granularity(&self) -> &super::super::super::api::Granularity {
        &self.granularity
    }
    #[inline]
    pub fn is_archived(&self) -> bool {
        self.is_archived
    }
    #[inline]
    pub fn dataset_type(&self) -> Option<&super::DatasetBackingType> {
        self.dataset_type.as_ref().map(|o| &*o)
    }
    /// Definition for a derived dataset. When present, this dataset is virtual and backed by the referenced
    /// provided Dataset definition instead of persisted dataset files.
    #[inline]
    pub fn derived_definition(&self) -> Option<&super::DerivedDefinition> {
        self.derived_definition.as_ref().map(|o| &**o)
    }
}
