// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::needless_question_mark)]
pub fn de_storage_class_analysis_data_export(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::StorageClassAnalysisDataExport, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::StorageClassAnalysisDataExport::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("OutputSchemaVersion") /* OutputSchemaVersion com.amazonaws.s3#StorageClassAnalysisDataExport$OutputSchemaVersion */ =>  {
                let var_1 =
                    Some(
                        Result::<crate::types::StorageClassAnalysisSchemaVersion, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::StorageClassAnalysisSchemaVersion::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_output_schema_version(var_1);
            }
            ,
            s if s.matches("Destination") /* Destination com.amazonaws.s3#StorageClassAnalysisDataExport$Destination */ =>  {
                let var_2 =
                    Some(
                        crate::protocol_serde::shape_analytics_export_destination::de_analytics_export_destination(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_destination(var_2);
            }
            ,
            _ => {}
        }
    }
    Ok(crate::serde_util::storage_class_analysis_data_export_correct_errors(builder)
        .build()
        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}

pub fn ser_storage_class_analysis_data_export(
    input: &crate::types::StorageClassAnalysisDataExport,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    {
        let mut inner_writer = scope.start_el("OutputSchemaVersion").finish();
        inner_writer.data(input.output_schema_version.as_str());
    }
    if let Some(var_3) = &input.destination {
        let inner_writer = scope.start_el("Destination");
        crate::protocol_serde::shape_analytics_export_destination::ser_analytics_export_destination(var_3, inner_writer)?
    }
    scope.finish();
    Ok(())
}
