// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::needless_question_mark)]
pub fn de_object_version(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::ObjectVersion, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::ObjectVersion::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("ETag") /* ETag com.amazonaws.s3#ObjectVersion$ETag */ =>  {
                let var_1 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_e_tag(var_1);
            }
            ,
            s if s.matches("ChecksumAlgorithm") /* ChecksumAlgorithm com.amazonaws.s3#ObjectVersion$ChecksumAlgorithm */ =>  {
                let var_2 =
                    Some(
                        Result::<::std::vec::Vec::<crate::types::ChecksumAlgorithm>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
                            let mut list_3 = builder.checksum_algorithm.take().unwrap_or_default();
                            list_3.push(
                                Result::<crate::types::ChecksumAlgorithm, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                                    crate::types::ChecksumAlgorithm::from(
                                        ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                                    )
                                )
                                ?
                            );
                            list_3
                        })
                        ?
                    )
                ;
                builder = builder.set_checksum_algorithm(var_2);
            }
            ,
            s if s.matches("ChecksumType") /* ChecksumType com.amazonaws.s3#ObjectVersion$ChecksumType */ =>  {
                let var_4 =
                    Some(
                        Result::<crate::types::ChecksumType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::ChecksumType::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_checksum_type(var_4);
            }
            ,
            s if s.matches("Size") /* Size com.amazonaws.s3#ObjectVersion$Size */ =>  {
                let var_5 =
                    Some(
                         {
                            <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.s3#Size`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_size(var_5);
            }
            ,
            s if s.matches("StorageClass") /* StorageClass com.amazonaws.s3#ObjectVersion$StorageClass */ =>  {
                let var_6 =
                    Some(
                        Result::<crate::types::ObjectVersionStorageClass, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::ObjectVersionStorageClass::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_storage_class(var_6);
            }
            ,
            s if s.matches("Key") /* Key com.amazonaws.s3#ObjectVersion$Key */ =>  {
                let var_7 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_key(var_7);
            }
            ,
            s if s.matches("VersionId") /* VersionId com.amazonaws.s3#ObjectVersion$VersionId */ =>  {
                let var_8 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_version_id(var_8);
            }
            ,
            s if s.matches("IsLatest") /* IsLatest com.amazonaws.s3#ObjectVersion$IsLatest */ =>  {
                let var_9 =
                    Some(
                         {
                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.s3#IsLatest`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_is_latest(var_9);
            }
            ,
            s if s.matches("LastModified") /* LastModified com.amazonaws.s3#ObjectVersion$LastModified */ =>  {
                let var_10 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.s3#LastModified`)"))
                        ?
                    )
                ;
                builder = builder.set_last_modified(var_10);
            }
            ,
            s if s.matches("Owner") /* Owner com.amazonaws.s3#ObjectVersion$Owner */ =>  {
                let var_11 =
                    Some(
                        crate::protocol_serde::shape_owner::de_owner(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_owner(var_11);
            }
            ,
            s if s.matches("RestoreStatus") /* RestoreStatus com.amazonaws.s3#ObjectVersion$RestoreStatus */ =>  {
                let var_12 =
                    Some(
                        crate::protocol_serde::shape_restore_status::de_restore_status(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_restore_status(var_12);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}
