/// Fields that are empty will be treated as a no-op update.
#[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 UpdateConnectionRequest {
    #[builder(default, into)]
    #[serde(rename = "name", skip_serializing_if = "Option::is_none", default)]
    name: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
    description: Option<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::ConnectionDetails>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(
        rename = "connectionDetails",
        skip_serializing_if = "Option::is_none",
        default
    )]
    connection_details: Option<Box<super::ConnectionDetails>>,
    #[builder(default, into)]
    #[serde(
        rename = "requiredTagNames",
        skip_serializing_if = "Option::is_none",
        default
    )]
    required_tag_names: Option<std::collections::BTreeSet<String>>,
    #[builder(default, into)]
    #[serde(
        rename = "availableTagValues",
        skip_serializing_if = "Option::is_none",
        default
    )]
    available_tag_values: Option<
        std::collections::BTreeMap<String, std::collections::BTreeSet<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>>,
    #[builder(default, into)]
    #[serde(rename = "shouldScrape", skip_serializing_if = "Option::is_none", default)]
    should_scrape: Option<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>>,
}
impl UpdateConnectionRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn name(&self) -> Option<&str> {
        self.name.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn description(&self) -> Option<&str> {
        self.description.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn metadata(&self) -> Option<&std::collections::BTreeMap<String, String>> {
        self.metadata.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn connection_details(&self) -> Option<&super::ConnectionDetails> {
        self.connection_details.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn required_tag_names(&self) -> Option<&std::collections::BTreeSet<String>> {
        self.required_tag_names.as_ref().map(|o| &*o)
    }
    /// In most cases, this does not to be set by the user. Throws if populated for Nominal connections, which
    /// have their tags automatically indexed in the underlying database. Tags for external connections are
    /// periodically scraped. Tags should only be updated manually for Visual crossing connections.
    #[inline]
    pub fn available_tag_values(
        &self,
    ) -> Option<
        &std::collections::BTreeMap<String, std::collections::BTreeSet<String>>,
    > {
        self.available_tag_values.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn scraping(&self) -> Option<&super::ScrapingConfig> {
        self.scraping.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn should_scrape(&self) -> Option<bool> {
        self.should_scrape.as_ref().map(|o| *o)
    }
    #[inline]
    pub fn limits(&self) -> Option<&super::LimitsConfig> {
        self.limits.as_ref().map(|o| &**o)
    }
}
