#[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 Connection {
    #[serde(rename = "rid")]
    rid: super::ConnectionRid,
    #[builder(into)]
    #[serde(rename = "displayName")]
    display_name: String,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<String>,
    #[builder(custom(type = super::ConnectionDetails, convert = Box::new))]
    #[serde(rename = "connectionDetails")]
    connection_details: Box<super::ConnectionDetails>,
    #[builder(default, set(item(type = String, into)))]
    #[serde(
        rename = "requiredTagNames",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    required_tag_names: std::collections::BTreeSet<String>,
    #[builder(default, map(key(type = String, into), value(type = String, into)))]
    #[serde(
        rename = "metadata",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    metadata: std::collections::BTreeMap<String, String>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::ScrapingConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "scraping", skip_serializing_if = "Option::is_none", default)]
    scraping: Option<Box<super::ScrapingConfig>>,
    #[serde(rename = "shouldScrape")]
    should_scrape: bool,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::LimitsConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "limits", skip_serializing_if = "Option::is_none", default)]
    limits: Option<Box<super::LimitsConfig>>,
    #[builder(custom(type = super::ConnectionStatus, convert = Box::new))]
    #[serde(rename = "connectionStatus")]
    connection_status: Box<super::ConnectionStatus>,
    #[serde(rename = "isArchived")]
    is_archived: bool,
}
impl Connection {
    #[inline]
    pub fn rid(&self) -> &super::ConnectionRid {
        &self.rid
    }
    /// The display name of the connection. For example: "Nominal production TimescaleDB"
    #[inline]
    pub fn display_name(&self) -> &str {
        &*self.display_name
    }
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn connection_details(&self) -> &super::ConnectionDetails {
        &*self.connection_details
    }
    /// Additional tag names that should be supplied to construct a fully qualified series. These are suggested,
    /// rather than strictly required.
    #[inline]
    pub fn required_tag_names(&self) -> &std::collections::BTreeSet<String> {
        &self.required_tag_names
    }
    #[inline]
    pub fn metadata(&self) -> &std::collections::BTreeMap<String, String> {
        &self.metadata
    }
    #[inline]
    pub fn scraping(&self) -> Option<&super::ScrapingConfig> {
        self.scraping.as_ref().map(|o| &**o)
    }
    /// The connection will be scraped iff this flag is set and scrapingConfig is present.
    #[inline]
    pub fn should_scrape(&self) -> bool {
        self.should_scrape
    }
    #[inline]
    pub fn limits(&self) -> Option<&super::LimitsConfig> {
        self.limits.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn connection_status(&self) -> &super::ConnectionStatus {
        &*self.connection_status
    }
    #[inline]
    pub fn is_archived(&self) -> bool {
        self.is_archived
    }
}
