// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_recorder_config<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::RecorderConfig>, ::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::RecorderConfigBuilder::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() {
                        "MediaSourceConfig" => {
                            builder =
                                builder.set_media_source_config(crate::protocol_serde::shape_media_source_config::de_media_source_config(tokens)?);
                        }
                        "ScheduleConfig" => {
                            builder = builder.set_schedule_config(crate::protocol_serde::shape_schedule_config::de_schedule_config(tokens)?);
                        }
                        _ => ::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(crate::serde_util::recorder_config_correct_errors(builder).build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}

pub fn ser_recorder_config(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::RecorderConfig,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.media_source_config {
        #[allow(unused_mut)]
        let mut object_2 = object.key("MediaSourceConfig").start_object();
        crate::protocol_serde::shape_media_source_config::ser_media_source_config(&mut object_2, var_1)?;
        object_2.finish();
    }
    if let Some(var_3) = &input.schedule_config {
        #[allow(unused_mut)]
        let mut object_4 = object.key("ScheduleConfig").start_object();
        crate::protocol_serde::shape_schedule_config::ser_schedule_config(&mut object_4, var_3)?;
        object_4.finish();
    }
    Ok(())
}
