/// Metadata for a channel as it appears at one specific locator. Channels can have different
/// metadata (seriesId, dataType, unit) across locators, so callers should treat each entry
/// independently.
#[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 LocatorChannelMetadata {
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::Locator>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "locator", skip_serializing_if = "Option::is_none", default)]
    locator: Option<Box<super::Locator>>,
    #[builder(default, into)]
    #[serde(rename = "unit", skip_serializing_if = "Option::is_none", default)]
    unit: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "dataType", skip_serializing_if = "Option::is_none", default)]
    data_type: Option<super::super::super::super::api::SeriesDataType>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::datasource::api::SeriesMetadataRidOrLogicalSeriesRid>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "seriesId", skip_serializing_if = "Option::is_none", default)]
    series_id: Option<
        Box<
            super::super::super::super::datasource::api::SeriesMetadataRidOrLogicalSeriesRid,
        >,
    >,
}
impl LocatorChannelMetadata {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    /// Absent for an ephemeral (compute-defined) channel that has no stored series to point at — an unsaved
    /// `withNumericSeries`/`withEnumSeries` in the request scope. Present for stored and derived-dataset channels.
    #[inline]
    pub fn locator(&self) -> Option<&super::Locator> {
        self.locator.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn unit(&self) -> Option<&str> {
        self.unit.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn data_type(&self) -> Option<&super::super::super::super::api::SeriesDataType> {
        self.data_type.as_ref().map(|o| &*o)
    }
    /// Absent for derived channels.
    #[inline]
    pub fn series_id(
        &self,
    ) -> Option<
        &super::super::super::super::datasource::api::SeriesMetadataRidOrLogicalSeriesRid,
    > {
        self.series_id.as_ref().map(|o| &**o)
    }
}
