/// A SerializableError is a representation of a ServiceException that exists to send error
/// results to clients as part of a response object when directly throwing an exception is undesirable.
#[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 SerializableError {
    #[builder(into)]
    #[serde(rename = "name")]
    name: String,
    #[builder(default, into)]
    #[serde(rename = "message", skip_serializing_if = "Option::is_none", default)]
    message: Option<String>,
    #[builder(into)]
    #[serde(rename = "errorInstanceId")]
    error_instance_id: String,
    #[serde(rename = "statusCode")]
    status_code: i32,
    #[builder(default, map(key(type = String, into), value(type = String, into)))]
    #[serde(
        rename = "params",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    params: std::collections::BTreeMap<String, String>,
}
impl SerializableError {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        name: impl Into<String>,
        error_instance_id: impl Into<String>,
        status_code: i32,
    ) -> Self {
        Self::builder()
            .name(name)
            .error_instance_id(error_instance_id)
            .status_code(status_code)
            .build()
    }
    #[inline]
    pub fn name(&self) -> &str {
        &*self.name
    }
    #[inline]
    pub fn message(&self) -> Option<&str> {
        self.message.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn error_instance_id(&self) -> &str {
        &*self.error_instance_id
    }
    #[inline]
    pub fn status_code(&self) -> i32 {
        self.status_code
    }
    #[inline]
    pub fn params(&self) -> &std::collections::BTreeMap<String, String> {
        &self.params
    }
}
