// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_count_tokens_input_input(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::operation::count_tokens::CountTokensInput,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.input {
        #[allow(unused_mut)]
        let mut object_2 = object.key("input").start_object();
        crate::protocol_serde::shape_count_tokens_input::ser_count_tokens_input(&mut object_2, var_1)?;
        object_2.finish();
    }
    Ok(())
}

pub fn ser_count_tokens_input(
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::CountTokensInput,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    match input {
        crate::types::CountTokensInput::InvokeModel(inner) => {
            #[allow(unused_mut)]
            let mut object_3 = object_2.key("invokeModel").start_object();
            crate::protocol_serde::shape_invoke_model_tokens_request::ser_invoke_model_tokens_request(&mut object_3, inner)?;
            object_3.finish();
        }
        crate::types::CountTokensInput::Converse(inner) => {
            #[allow(unused_mut)]
            let mut object_4 = object_2.key("converse").start_object();
            crate::protocol_serde::shape_converse_tokens_request::ser_converse_tokens_request(&mut object_4, inner)?;
            object_4.finish();
        }
        crate::types::CountTokensInput::Unknown => {
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
                "CountTokensInput",
            ))
        }
    }
    Ok(())
}
