#[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 EnrichedDataset {
    #[serde(rename = "rid")]
    rid: conjure_object::ResourceIdentifier,
    #[serde(rename = "uuid")]
    uuid: conjure_object::Uuid,
    #[builder(into)]
    #[serde(rename = "name")]
    name: String,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(into)]
    #[serde(rename = "displayName")]
    display_name: String,
    #[builder(default, into)]
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none", default)]
    metadata: Option<std::collections::BTreeMap<String, 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>>,
    #[serde(rename = "ingestDate")]
    ingest_date: conjure_object::DateTime<conjure_object::Utc>,
    #[builder(default, into)]
    #[serde(rename = "ingestStatus", skip_serializing_if = "Option::is_none", default)]
    ingest_status: Option<super::IngestStatus>,
    #[builder(custom(type = super::DatasetOriginMetadata, convert = Box::new))]
    #[serde(rename = "originMetadata")]
    origin_metadata: Box<super::DatasetOriginMetadata>,
    #[builder(
        custom(type = super::super::super::api::IngestStatusV2, convert = Box::new)
    )]
    #[serde(rename = "lastIngestStatus")]
    last_ingest_status: Box<super::super::super::api::IngestStatusV2>,
    #[builder(custom(type = super::RetentionPolicy, convert = Box::new))]
    #[serde(rename = "retentionPolicy")]
    retention_policy: Box<super::RetentionPolicy>,
    #[builder(default, into)]
    #[serde(rename = "source", skip_serializing_if = "Option::is_none", default)]
    source: Option<String>,
    #[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>>,
    #[serde(rename = "timestampType")]
    timestamp_type: super::WeakTimestampType,
    #[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 = "granularity")]
    granularity: super::super::super::api::Granularity,
    #[serde(rename = "allowStreaming")]
    allow_streaming: bool,
    #[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, into)]
    #[serde(
        rename = "migratedFromConnectionRid",
        skip_serializing_if = "Option::is_none",
        default
    )]
    migrated_from_connection_rid: Option<
        super::super::datasource::connection::api::ConnectionRid,
    >,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::ExternalConnectionMetadata>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "externalConnectionMetadata",
        skip_serializing_if = "Option::is_none",
        default
    )]
    external_connection_metadata: Option<Box<super::ExternalConnectionMetadata>>,
    #[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 EnrichedDataset {
    #[inline]
    pub fn rid(&self) -> &conjure_object::ResourceIdentifier {
        &self.rid
    }
    #[inline]
    pub fn uuid(&self) -> conjure_object::Uuid {
        self.uuid
    }
    #[inline]
    pub fn name(&self) -> &str {
        &*self.name
    }
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn display_name(&self) -> &str {
        &*self.display_name
    }
    #[deprecated(note = "Deprecated in favor of properties.")]
    #[inline]
    pub fn metadata(&self) -> Option<&std::collections::BTreeMap<String, String>> {
        self.metadata.as_ref().map(|o| &*o)
    }
    #[deprecated(note = "Deprecated. Use DatasetFile#handle")]
    #[inline]
    pub fn handle(&self) -> Option<&super::Handle> {
        self.handle.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn ingest_date(&self) -> conjure_object::DateTime<conjure_object::Utc> {
        self.ingest_date
    }
    #[deprecated(note = "Deprecated. Use lastIngestStatus.")]
    #[inline]
    pub fn ingest_status(&self) -> Option<&super::IngestStatus> {
        self.ingest_status.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn origin_metadata(&self) -> &super::DatasetOriginMetadata {
        &*self.origin_metadata
    }
    #[inline]
    pub fn last_ingest_status(&self) -> &super::super::super::api::IngestStatusV2 {
        &*self.last_ingest_status
    }
    #[inline]
    pub fn retention_policy(&self) -> &super::RetentionPolicy {
        &*self.retention_policy
    }
    #[inline]
    pub fn source(&self) -> Option<&str> {
        self.source.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn bounds(&self) -> Option<&super::Bounds> {
        self.bounds.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn timestamp_type(&self) -> &super::WeakTimestampType {
        &self.timestamp_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 granularity(&self) -> &super::super::super::api::Granularity {
        &self.granularity
    }
    #[inline]
    pub fn allow_streaming(&self) -> bool {
        self.allow_streaming
    }
    #[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)
    }
    /// Connection RID whose data source was migrated into this dataset. Empty for datasets that were not created
    /// by the legacy connection-to-dataset migrations, or when the original connection row no longer exists.
    #[inline]
    pub fn migrated_from_connection_rid(
        &self,
    ) -> Option<&super::super::datasource::connection::api::ConnectionRid> {
        self.migrated_from_connection_rid.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn external_connection_metadata(
        &self,
    ) -> Option<&super::ExternalConnectionMetadata> {
        self.external_connection_metadata.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)
    }
}
