/// 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(custom(type = super::Locator, convert = Box::new))]
    #[serde(rename = "locator")]
    locator: 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(
        custom(
            type = super::super::super::super::datasource::api::SeriesMetadataRidOrLogicalSeriesRid,
            convert = Box::new
        )
    )]
    #[serde(rename = "seriesId")]
    series_id: Box<
        super::super::super::super::datasource::api::SeriesMetadataRidOrLogicalSeriesRid,
    >,
}
impl LocatorChannelMetadata {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        locator: super::Locator,
        series_id: super::super::super::super::datasource::api::SeriesMetadataRidOrLogicalSeriesRid,
    ) -> Self {
        Self::builder().locator(locator).series_id(series_id).build()
    }
    #[inline]
    pub fn locator(&self) -> &super::Locator {
        &*self.locator
    }
    #[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)
    }
    #[inline]
    pub fn series_id(
        &self,
    ) -> &super::super::super::super::datasource::api::SeriesMetadataRidOrLogicalSeriesRid {
        &*self.series_id
    }
}
