/// Attaches external connection configuration to an existing dataset.
#[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 RegisterExternalConnectionConfigRequest {
    #[serde(rename = "datasetRid")]
    dataset_rid: conjure_object::ResourceIdentifier,
    #[builder(
        custom(
            type = super::super::datasource::connection::api::ConnectionDetails,
            convert = Box::new
        )
    )]
    #[serde(rename = "connectionDetails")]
    connection_details: Box<
        super::super::datasource::connection::api::ConnectionDetails,
    >,
    #[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, 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, 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::super::datasource::connection::api::ScrapingConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "scraping", skip_serializing_if = "Option::is_none", default)]
    scraping: Option<Box<super::super::datasource::connection::api::ScrapingConfig>>,
    #[serde(rename = "shouldScrape")]
    should_scrape: bool,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::datasource::connection::api::LimitsConfig>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "limits", skip_serializing_if = "Option::is_none", default)]
    limits: Option<Box<super::super::datasource::connection::api::LimitsConfig>>,
}
impl RegisterExternalConnectionConfigRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        dataset_rid: conjure_object::ResourceIdentifier,
        connection_details: super::super::datasource::connection::api::ConnectionDetails,
        should_scrape: bool,
    ) -> Self {
        Self::builder()
            .dataset_rid(dataset_rid)
            .connection_details(connection_details)
            .should_scrape(should_scrape)
            .build()
    }
    #[inline]
    pub fn dataset_rid(&self) -> &conjure_object::ResourceIdentifier {
        &self.dataset_rid
    }
    #[inline]
    pub fn connection_details(
        &self,
    ) -> &super::super::datasource::connection::api::ConnectionDetails {
        &*self.connection_details
    }
    /// Metadata information about the external connection configuration.
    #[inline]
    pub fn metadata(&self) -> &std::collections::BTreeMap<String, String> {
        &self.metadata
    }
    /// Additional tag names that are required to construct a fully qualified series.
    #[inline]
    pub fn required_tag_names(&self) -> &std::collections::BTreeSet<String> {
        &self.required_tag_names
    }
    /// Optional externally supplied tag values. In most cases these are indexed by scraping.
    #[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::super::datasource::connection::api::ScrapingConfig> {
        self.scraping.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn should_scrape(&self) -> bool {
        self.should_scrape
    }
    #[inline]
    pub fn limits(
        &self,
    ) -> Option<&super::super::datasource::connection::api::LimitsConfig> {
        self.limits.as_ref().map(|o| &**o)
    }
}
