// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_structure_crate_input_add_tags_to_stream_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::AddTagsToStreamInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_1) = &input.stream_name {
        object.key("StreamName").string(var_1);
    }
    if let Some(var_2) = &input.tags {
        let mut object_3 = object.key("Tags").start_object();
        for (key_4, value_5) in var_2 {
            {
                object_3.key(key_4).string(value_5);
            }
        }
        object_3.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_stream_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateStreamInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_6) = &input.stream_name {
        object.key("StreamName").string(var_6);
    }
    if let Some(var_7) = &input.shard_count {
        object.key("ShardCount").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_7).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_decrease_stream_retention_period_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DecreaseStreamRetentionPeriodInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_8) = &input.stream_name {
        object.key("StreamName").string(var_8);
    }
    if let Some(var_9) = &input.retention_period_hours {
        object.key("RetentionPeriodHours").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_9).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_stream_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteStreamInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_10) = &input.stream_name {
        object.key("StreamName").string(var_10);
    }
    if let Some(var_11) = &input.enforce_consumer_deletion {
        object.key("EnforceConsumerDeletion").boolean(*var_11);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_deregister_stream_consumer_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeregisterStreamConsumerInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_12) = &input.stream_arn {
        object.key("StreamARN").string(var_12);
    }
    if let Some(var_13) = &input.consumer_name {
        object.key("ConsumerName").string(var_13);
    }
    if let Some(var_14) = &input.consumer_arn {
        object.key("ConsumerARN").string(var_14);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_describe_stream_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeStreamInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_15) = &input.stream_name {
        object.key("StreamName").string(var_15);
    }
    if let Some(var_16) = &input.limit {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_16).into()),
        );
    }
    if let Some(var_17) = &input.exclusive_start_shard_id {
        object.key("ExclusiveStartShardId").string(var_17);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_describe_stream_consumer_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeStreamConsumerInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_18) = &input.stream_arn {
        object.key("StreamARN").string(var_18);
    }
    if let Some(var_19) = &input.consumer_name {
        object.key("ConsumerName").string(var_19);
    }
    if let Some(var_20) = &input.consumer_arn {
        object.key("ConsumerARN").string(var_20);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_describe_stream_summary_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeStreamSummaryInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_21) = &input.stream_name {
        object.key("StreamName").string(var_21);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_disable_enhanced_monitoring_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DisableEnhancedMonitoringInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_22) = &input.stream_name {
        object.key("StreamName").string(var_22);
    }
    if let Some(var_23) = &input.shard_level_metrics {
        let mut array_24 = object.key("ShardLevelMetrics").start_array();
        for item_25 in var_23 {
            {
                array_24.value().string(item_25.as_str());
            }
        }
        array_24.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_enable_enhanced_monitoring_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::EnableEnhancedMonitoringInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_26) = &input.stream_name {
        object.key("StreamName").string(var_26);
    }
    if let Some(var_27) = &input.shard_level_metrics {
        let mut array_28 = object.key("ShardLevelMetrics").start_array();
        for item_29 in var_27 {
            {
                array_28.value().string(item_29.as_str());
            }
        }
        array_28.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_records_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRecordsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_30) = &input.shard_iterator {
        object.key("ShardIterator").string(var_30);
    }
    if let Some(var_31) = &input.limit {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_31).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_shard_iterator_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetShardIteratorInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_32) = &input.stream_name {
        object.key("StreamName").string(var_32);
    }
    if let Some(var_33) = &input.shard_id {
        object.key("ShardId").string(var_33);
    }
    if let Some(var_34) = &input.shard_iterator_type {
        object.key("ShardIteratorType").string(var_34.as_str());
    }
    if let Some(var_35) = &input.starting_sequence_number {
        object.key("StartingSequenceNumber").string(var_35);
    }
    if let Some(var_36) = &input.timestamp {
        object
            .key("Timestamp")
            .instant(var_36, aws_smithy_types::instant::Format::EpochSeconds);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_increase_stream_retention_period_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::IncreaseStreamRetentionPeriodInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_37) = &input.stream_name {
        object.key("StreamName").string(var_37);
    }
    if let Some(var_38) = &input.retention_period_hours {
        object.key("RetentionPeriodHours").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_38).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_shards_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListShardsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_39) = &input.stream_name {
        object.key("StreamName").string(var_39);
    }
    if let Some(var_40) = &input.next_token {
        object.key("NextToken").string(var_40);
    }
    if let Some(var_41) = &input.exclusive_start_shard_id {
        object.key("ExclusiveStartShardId").string(var_41);
    }
    if let Some(var_42) = &input.max_results {
        object.key("MaxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_42).into()),
        );
    }
    if let Some(var_43) = &input.stream_creation_timestamp {
        object
            .key("StreamCreationTimestamp")
            .instant(var_43, aws_smithy_types::instant::Format::EpochSeconds);
    }
    if let Some(var_44) = &input.shard_filter {
        let mut object_45 = object.key("ShardFilter").start_object();
        crate::json_ser::serialize_structure_crate_model_shard_filter(&mut object_45, var_44)?;
        object_45.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_stream_consumers_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListStreamConsumersInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_46) = &input.stream_arn {
        object.key("StreamARN").string(var_46);
    }
    if let Some(var_47) = &input.next_token {
        object.key("NextToken").string(var_47);
    }
    if let Some(var_48) = &input.max_results {
        object.key("MaxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_48).into()),
        );
    }
    if let Some(var_49) = &input.stream_creation_timestamp {
        object
            .key("StreamCreationTimestamp")
            .instant(var_49, aws_smithy_types::instant::Format::EpochSeconds);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_streams_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListStreamsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_50) = &input.limit {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_50).into()),
        );
    }
    if let Some(var_51) = &input.exclusive_start_stream_name {
        object.key("ExclusiveStartStreamName").string(var_51);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_tags_for_stream_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListTagsForStreamInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_52) = &input.stream_name {
        object.key("StreamName").string(var_52);
    }
    if let Some(var_53) = &input.exclusive_start_tag_key {
        object.key("ExclusiveStartTagKey").string(var_53);
    }
    if let Some(var_54) = &input.limit {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_54).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_merge_shards_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::MergeShardsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_55) = &input.stream_name {
        object.key("StreamName").string(var_55);
    }
    if let Some(var_56) = &input.shard_to_merge {
        object.key("ShardToMerge").string(var_56);
    }
    if let Some(var_57) = &input.adjacent_shard_to_merge {
        object.key("AdjacentShardToMerge").string(var_57);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_put_record_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::PutRecordInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_58) = &input.stream_name {
        object.key("StreamName").string(var_58);
    }
    if let Some(var_59) = &input.data {
        object
            .key("Data")
            .string_unchecked(&aws_smithy_types::base64::encode(var_59));
    }
    if let Some(var_60) = &input.partition_key {
        object.key("PartitionKey").string(var_60);
    }
    if let Some(var_61) = &input.explicit_hash_key {
        object.key("ExplicitHashKey").string(var_61);
    }
    if let Some(var_62) = &input.sequence_number_for_ordering {
        object.key("SequenceNumberForOrdering").string(var_62);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_put_records_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::PutRecordsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_63) = &input.records {
        let mut array_64 = object.key("Records").start_array();
        for item_65 in var_63 {
            {
                let mut object_66 = array_64.value().start_object();
                crate::json_ser::serialize_structure_crate_model_put_records_request_entry(
                    &mut object_66,
                    item_65,
                )?;
                object_66.finish();
            }
        }
        array_64.finish();
    }
    if let Some(var_67) = &input.stream_name {
        object.key("StreamName").string(var_67);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_register_stream_consumer_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::RegisterStreamConsumerInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_68) = &input.stream_arn {
        object.key("StreamARN").string(var_68);
    }
    if let Some(var_69) = &input.consumer_name {
        object.key("ConsumerName").string(var_69);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_remove_tags_from_stream_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::RemoveTagsFromStreamInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_70) = &input.stream_name {
        object.key("StreamName").string(var_70);
    }
    if let Some(var_71) = &input.tag_keys {
        let mut array_72 = object.key("TagKeys").start_array();
        for item_73 in var_71 {
            {
                array_72.value().string(item_73);
            }
        }
        array_72.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_split_shard_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::SplitShardInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_74) = &input.stream_name {
        object.key("StreamName").string(var_74);
    }
    if let Some(var_75) = &input.shard_to_split {
        object.key("ShardToSplit").string(var_75);
    }
    if let Some(var_76) = &input.new_starting_hash_key {
        object.key("NewStartingHashKey").string(var_76);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_start_stream_encryption_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::StartStreamEncryptionInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_77) = &input.stream_name {
        object.key("StreamName").string(var_77);
    }
    if let Some(var_78) = &input.encryption_type {
        object.key("EncryptionType").string(var_78.as_str());
    }
    if let Some(var_79) = &input.key_id {
        object.key("KeyId").string(var_79);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_stop_stream_encryption_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::StopStreamEncryptionInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_80) = &input.stream_name {
        object.key("StreamName").string(var_80);
    }
    if let Some(var_81) = &input.encryption_type {
        object.key("EncryptionType").string(var_81.as_str());
    }
    if let Some(var_82) = &input.key_id {
        object.key("KeyId").string(var_82);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_shard_count_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateShardCountInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_83) = &input.stream_name {
        object.key("StreamName").string(var_83);
    }
    if let Some(var_84) = &input.target_shard_count {
        object.key("TargetShardCount").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_84).into()),
        );
    }
    if let Some(var_85) = &input.scaling_type {
        object.key("ScalingType").string(var_85.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_shard_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ShardFilter,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_86) = &input.r#type {
        object.key("Type").string(var_86.as_str());
    }
    if let Some(var_87) = &input.shard_id {
        object.key("ShardId").string(var_87);
    }
    if let Some(var_88) = &input.timestamp {
        object
            .key("Timestamp")
            .instant(var_88, aws_smithy_types::instant::Format::EpochSeconds);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_put_records_request_entry(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::PutRecordsRequestEntry,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_89) = &input.data {
        object
            .key("Data")
            .string_unchecked(&aws_smithy_types::base64::encode(var_89));
    }
    if let Some(var_90) = &input.explicit_hash_key {
        object.key("ExplicitHashKey").string(var_90);
    }
    if let Some(var_91) = &input.partition_key {
        object.key("PartitionKey").string(var_91);
    }
    Ok(())
}
