// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_recording_group<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::RecordingGroup>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    match tokens.next().transpose()? {
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
            #[allow(unused_mut)]
            let mut builder = crate::types::builders::RecordingGroupBuilder::default();
            loop {
                match tokens.next().transpose()? {
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
                        "allSupported" => {
                            builder = builder.set_all_supported(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "includeGlobalResourceTypes" => {
                            builder =
                                builder.set_include_global_resource_types(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "resourceTypes" => {
                            builder =
                                builder.set_resource_types(crate::protocol_serde::shape_resource_type_list::de_resource_type_list(tokens, _value)?);
                        }
                        "exclusionByResourceTypes" => {
                            builder = builder.set_exclusion_by_resource_types(
                                crate::protocol_serde::shape_exclusion_by_resource_types::de_exclusion_by_resource_types(tokens, _value)?,
                            );
                        }
                        "recordingStrategy" => {
                            builder = builder
                                .set_recording_strategy(crate::protocol_serde::shape_recording_strategy::de_recording_strategy(tokens, _value)?);
                        }
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
                    },
                    other => {
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
                            "expected object key or end object, found: {other:?}"
                        )))
                    }
                }
            }
            Ok(Some(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}

pub fn ser_recording_group(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::RecordingGroup,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if input.all_supported {
        object.key("allSupported").boolean(input.all_supported);
    }
    if input.include_global_resource_types {
        object.key("includeGlobalResourceTypes").boolean(input.include_global_resource_types);
    }
    if let Some(var_1) = &input.resource_types {
        let mut array_2 = object.key("resourceTypes").start_array();
        for item_3 in var_1 {
            {
                array_2.value().string(item_3.as_str());
            }
        }
        array_2.finish();
    }
    if let Some(var_4) = &input.exclusion_by_resource_types {
        #[allow(unused_mut)]
        let mut object_5 = object.key("exclusionByResourceTypes").start_object();
        crate::protocol_serde::shape_exclusion_by_resource_types::ser_exclusion_by_resource_types(&mut object_5, var_4)?;
        object_5.finish();
    }
    if let Some(var_6) = &input.recording_strategy {
        #[allow(unused_mut)]
        let mut object_7 = object.key("recordingStrategy").start_object();
        crate::protocol_serde::shape_recording_strategy::ser_recording_strategy(&mut object_7, var_6)?;
        object_7.finish();
    }
    Ok(())
}
