#[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 ExternalConnectionMetadata {
    #[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(
        custom(
            type = super::super::datasource::connection::api::ConnectionStatus,
            convert = Box::new
        )
    )]
    #[serde(rename = "connectionStatus")]
    connection_status: Box<super::super::datasource::connection::api::ConnectionStatus>,
    #[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 ExternalConnectionMetadata {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        connection_details: super::super::datasource::connection::api::ConnectionDetails,
        connection_status: super::super::datasource::connection::api::ConnectionStatus,
    ) -> Self {
        Self::builder()
            .connection_details(connection_details)
            .connection_status(connection_status)
            .build()
    }
    #[inline]
    pub fn connection_details(
        &self,
    ) -> &super::super::datasource::connection::api::ConnectionDetails {
        &*self.connection_details
    }
    #[inline]
    pub fn connection_status(
        &self,
    ) -> &super::super::datasource::connection::api::ConnectionStatus {
        &*self.connection_status
    }
    #[inline]
    pub fn limits(
        &self,
    ) -> Option<&super::super::datasource::connection::api::LimitsConfig> {
        self.limits.as_ref().map(|o| &**o)
    }
}
