// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_structure_crate_input_describe_recommendation_export_jobs_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeRecommendationExportJobsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_1) = &input.job_ids {
        let mut array_2 = object.key("jobIds").start_array();
        for item_3 in var_1 {
            {
                array_2.value().string(item_3);
            }
        }
        array_2.finish();
    }
    if let Some(var_4) = &input.filters {
        let mut array_5 = object.key("filters").start_array();
        for item_6 in var_4 {
            {
                let mut object_7 = array_5.value().start_object();
                crate::json_ser::serialize_structure_crate_model_job_filter(&mut object_7, item_6)?;
                object_7.finish();
            }
        }
        array_5.finish();
    }
    if let Some(var_8) = &input.next_token {
        object.key("nextToken").string(var_8);
    }
    if let Some(var_9) = &input.max_results {
        object.key("maxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_9).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_export_auto_scaling_group_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ExportAutoScalingGroupRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_10) = &input.account_ids {
        let mut array_11 = object.key("accountIds").start_array();
        for item_12 in var_10 {
            {
                array_11.value().string(item_12);
            }
        }
        array_11.finish();
    }
    if let Some(var_13) = &input.filters {
        let mut array_14 = object.key("filters").start_array();
        for item_15 in var_13 {
            {
                let mut object_16 = array_14.value().start_object();
                crate::json_ser::serialize_structure_crate_model_filter(&mut object_16, item_15)?;
                object_16.finish();
            }
        }
        array_14.finish();
    }
    if let Some(var_17) = &input.fields_to_export {
        let mut array_18 = object.key("fieldsToExport").start_array();
        for item_19 in var_17 {
            {
                array_18.value().string(item_19.as_str());
            }
        }
        array_18.finish();
    }
    if let Some(var_20) = &input.s3_destination_config {
        let mut object_21 = object.key("s3DestinationConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_s3_destination_config(
            &mut object_21,
            var_20,
        )?;
        object_21.finish();
    }
    if let Some(var_22) = &input.file_format {
        object.key("fileFormat").string(var_22.as_str());
    }
    if input.include_member_accounts {
        object
            .key("includeMemberAccounts")
            .boolean(input.include_member_accounts);
    }
    if let Some(var_23) = &input.recommendation_preferences {
        let mut object_24 = object.key("recommendationPreferences").start_object();
        crate::json_ser::serialize_structure_crate_model_recommendation_preferences(
            &mut object_24,
            var_23,
        )?;
        object_24.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_export_ebs_volume_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ExportEbsVolumeRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_25) = &input.account_ids {
        let mut array_26 = object.key("accountIds").start_array();
        for item_27 in var_25 {
            {
                array_26.value().string(item_27);
            }
        }
        array_26.finish();
    }
    if let Some(var_28) = &input.filters {
        let mut array_29 = object.key("filters").start_array();
        for item_30 in var_28 {
            {
                let mut object_31 = array_29.value().start_object();
                crate::json_ser::serialize_structure_crate_model_ebs_filter(
                    &mut object_31,
                    item_30,
                )?;
                object_31.finish();
            }
        }
        array_29.finish();
    }
    if let Some(var_32) = &input.fields_to_export {
        let mut array_33 = object.key("fieldsToExport").start_array();
        for item_34 in var_32 {
            {
                array_33.value().string(item_34.as_str());
            }
        }
        array_33.finish();
    }
    if let Some(var_35) = &input.s3_destination_config {
        let mut object_36 = object.key("s3DestinationConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_s3_destination_config(
            &mut object_36,
            var_35,
        )?;
        object_36.finish();
    }
    if let Some(var_37) = &input.file_format {
        object.key("fileFormat").string(var_37.as_str());
    }
    if input.include_member_accounts {
        object
            .key("includeMemberAccounts")
            .boolean(input.include_member_accounts);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_export_ec2_instance_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ExportEc2InstanceRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_38) = &input.account_ids {
        let mut array_39 = object.key("accountIds").start_array();
        for item_40 in var_38 {
            {
                array_39.value().string(item_40);
            }
        }
        array_39.finish();
    }
    if let Some(var_41) = &input.filters {
        let mut array_42 = object.key("filters").start_array();
        for item_43 in var_41 {
            {
                let mut object_44 = array_42.value().start_object();
                crate::json_ser::serialize_structure_crate_model_filter(&mut object_44, item_43)?;
                object_44.finish();
            }
        }
        array_42.finish();
    }
    if let Some(var_45) = &input.fields_to_export {
        let mut array_46 = object.key("fieldsToExport").start_array();
        for item_47 in var_45 {
            {
                array_46.value().string(item_47.as_str());
            }
        }
        array_46.finish();
    }
    if let Some(var_48) = &input.s3_destination_config {
        let mut object_49 = object.key("s3DestinationConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_s3_destination_config(
            &mut object_49,
            var_48,
        )?;
        object_49.finish();
    }
    if let Some(var_50) = &input.file_format {
        object.key("fileFormat").string(var_50.as_str());
    }
    if input.include_member_accounts {
        object
            .key("includeMemberAccounts")
            .boolean(input.include_member_accounts);
    }
    if let Some(var_51) = &input.recommendation_preferences {
        let mut object_52 = object.key("recommendationPreferences").start_object();
        crate::json_ser::serialize_structure_crate_model_recommendation_preferences(
            &mut object_52,
            var_51,
        )?;
        object_52.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_export_lambda_function_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ExportLambdaFunctionRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_53) = &input.account_ids {
        let mut array_54 = object.key("accountIds").start_array();
        for item_55 in var_53 {
            {
                array_54.value().string(item_55);
            }
        }
        array_54.finish();
    }
    if let Some(var_56) = &input.filters {
        let mut array_57 = object.key("filters").start_array();
        for item_58 in var_56 {
            {
                let mut object_59 = array_57.value().start_object();
                crate::json_ser::serialize_structure_crate_model_lambda_function_recommendation_filter(&mut object_59, item_58)?;
                object_59.finish();
            }
        }
        array_57.finish();
    }
    if let Some(var_60) = &input.fields_to_export {
        let mut array_61 = object.key("fieldsToExport").start_array();
        for item_62 in var_60 {
            {
                array_61.value().string(item_62.as_str());
            }
        }
        array_61.finish();
    }
    if let Some(var_63) = &input.s3_destination_config {
        let mut object_64 = object.key("s3DestinationConfig").start_object();
        crate::json_ser::serialize_structure_crate_model_s3_destination_config(
            &mut object_64,
            var_63,
        )?;
        object_64.finish();
    }
    if let Some(var_65) = &input.file_format {
        object.key("fileFormat").string(var_65.as_str());
    }
    if input.include_member_accounts {
        object
            .key("includeMemberAccounts")
            .boolean(input.include_member_accounts);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_auto_scaling_group_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetAutoScalingGroupRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_66) = &input.account_ids {
        let mut array_67 = object.key("accountIds").start_array();
        for item_68 in var_66 {
            {
                array_67.value().string(item_68);
            }
        }
        array_67.finish();
    }
    if let Some(var_69) = &input.auto_scaling_group_arns {
        let mut array_70 = object.key("autoScalingGroupArns").start_array();
        for item_71 in var_69 {
            {
                array_70.value().string(item_71);
            }
        }
        array_70.finish();
    }
    if let Some(var_72) = &input.next_token {
        object.key("nextToken").string(var_72);
    }
    if let Some(var_73) = &input.max_results {
        object.key("maxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_73).into()),
        );
    }
    if let Some(var_74) = &input.filters {
        let mut array_75 = object.key("filters").start_array();
        for item_76 in var_74 {
            {
                let mut object_77 = array_75.value().start_object();
                crate::json_ser::serialize_structure_crate_model_filter(&mut object_77, item_76)?;
                object_77.finish();
            }
        }
        array_75.finish();
    }
    if let Some(var_78) = &input.recommendation_preferences {
        let mut object_79 = object.key("recommendationPreferences").start_object();
        crate::json_ser::serialize_structure_crate_model_recommendation_preferences(
            &mut object_79,
            var_78,
        )?;
        object_79.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_ebs_volume_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetEbsVolumeRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_80) = &input.volume_arns {
        let mut array_81 = object.key("volumeArns").start_array();
        for item_82 in var_80 {
            {
                array_81.value().string(item_82);
            }
        }
        array_81.finish();
    }
    if let Some(var_83) = &input.next_token {
        object.key("nextToken").string(var_83);
    }
    if let Some(var_84) = &input.max_results {
        object.key("maxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_84).into()),
        );
    }
    if let Some(var_85) = &input.filters {
        let mut array_86 = object.key("filters").start_array();
        for item_87 in var_85 {
            {
                let mut object_88 = array_86.value().start_object();
                crate::json_ser::serialize_structure_crate_model_ebs_filter(
                    &mut object_88,
                    item_87,
                )?;
                object_88.finish();
            }
        }
        array_86.finish();
    }
    if let Some(var_89) = &input.account_ids {
        let mut array_90 = object.key("accountIds").start_array();
        for item_91 in var_89 {
            {
                array_90.value().string(item_91);
            }
        }
        array_90.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_ec2_instance_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetEc2InstanceRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_92) = &input.instance_arns {
        let mut array_93 = object.key("instanceArns").start_array();
        for item_94 in var_92 {
            {
                array_93.value().string(item_94);
            }
        }
        array_93.finish();
    }
    if let Some(var_95) = &input.next_token {
        object.key("nextToken").string(var_95);
    }
    if let Some(var_96) = &input.max_results {
        object.key("maxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_96).into()),
        );
    }
    if let Some(var_97) = &input.filters {
        let mut array_98 = object.key("filters").start_array();
        for item_99 in var_97 {
            {
                let mut object_100 = array_98.value().start_object();
                crate::json_ser::serialize_structure_crate_model_filter(&mut object_100, item_99)?;
                object_100.finish();
            }
        }
        array_98.finish();
    }
    if let Some(var_101) = &input.account_ids {
        let mut array_102 = object.key("accountIds").start_array();
        for item_103 in var_101 {
            {
                array_102.value().string(item_103);
            }
        }
        array_102.finish();
    }
    if let Some(var_104) = &input.recommendation_preferences {
        let mut object_105 = object.key("recommendationPreferences").start_object();
        crate::json_ser::serialize_structure_crate_model_recommendation_preferences(
            &mut object_105,
            var_104,
        )?;
        object_105.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_ec2_recommendation_projected_metrics_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetEc2RecommendationProjectedMetricsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_106) = &input.instance_arn {
        object.key("instanceArn").string(var_106);
    }
    if let Some(var_107) = &input.stat {
        object.key("stat").string(var_107.as_str());
    }
    {
        object.key("period").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.period).into()),
        );
    }
    if let Some(var_108) = &input.start_time {
        object
            .key("startTime")
            .date_time(var_108, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_109) = &input.end_time {
        object
            .key("endTime")
            .date_time(var_109, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_110) = &input.recommendation_preferences {
        let mut object_111 = object.key("recommendationPreferences").start_object();
        crate::json_ser::serialize_structure_crate_model_recommendation_preferences(
            &mut object_111,
            var_110,
        )?;
        object_111.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_enrollment_statuses_for_organization_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetEnrollmentStatusesForOrganizationInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_112) = &input.filters {
        let mut array_113 = object.key("filters").start_array();
        for item_114 in var_112 {
            {
                let mut object_115 = array_113.value().start_object();
                crate::json_ser::serialize_structure_crate_model_enrollment_filter(
                    &mut object_115,
                    item_114,
                )?;
                object_115.finish();
            }
        }
        array_113.finish();
    }
    if let Some(var_116) = &input.next_token {
        object.key("nextToken").string(var_116);
    }
    if let Some(var_117) = &input.max_results {
        object.key("maxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_117).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_lambda_function_recommendations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetLambdaFunctionRecommendationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_118) = &input.function_arns {
        let mut array_119 = object.key("functionArns").start_array();
        for item_120 in var_118 {
            {
                array_119.value().string(item_120);
            }
        }
        array_119.finish();
    }
    if let Some(var_121) = &input.account_ids {
        let mut array_122 = object.key("accountIds").start_array();
        for item_123 in var_121 {
            {
                array_122.value().string(item_123);
            }
        }
        array_122.finish();
    }
    if let Some(var_124) = &input.filters {
        let mut array_125 = object.key("filters").start_array();
        for item_126 in var_124 {
            {
                let mut object_127 = array_125.value().start_object();
                crate::json_ser::serialize_structure_crate_model_lambda_function_recommendation_filter(&mut object_127, item_126)?;
                object_127.finish();
            }
        }
        array_125.finish();
    }
    if let Some(var_128) = &input.next_token {
        object.key("nextToken").string(var_128);
    }
    if let Some(var_129) = &input.max_results {
        object.key("maxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_129).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_recommendation_summaries_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRecommendationSummariesInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_130) = &input.account_ids {
        let mut array_131 = object.key("accountIds").start_array();
        for item_132 in var_130 {
            {
                array_131.value().string(item_132);
            }
        }
        array_131.finish();
    }
    if let Some(var_133) = &input.next_token {
        object.key("nextToken").string(var_133);
    }
    if let Some(var_134) = &input.max_results {
        object.key("maxResults").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_134).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_enrollment_status_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateEnrollmentStatusInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_135) = &input.status {
        object.key("status").string(var_135.as_str());
    }
    if input.include_member_accounts {
        object
            .key("includeMemberAccounts")
            .boolean(input.include_member_accounts);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_job_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::JobFilter,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_136) = &input.name {
        object.key("name").string(var_136.as_str());
    }
    if let Some(var_137) = &input.values {
        let mut array_138 = object.key("values").start_array();
        for item_139 in var_137 {
            {
                array_138.value().string(item_139);
            }
        }
        array_138.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Filter,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_140) = &input.name {
        object.key("name").string(var_140.as_str());
    }
    if let Some(var_141) = &input.values {
        let mut array_142 = object.key("values").start_array();
        for item_143 in var_141 {
            {
                array_142.value().string(item_143);
            }
        }
        array_142.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_s3_destination_config(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::S3DestinationConfig,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_144) = &input.bucket {
        object.key("bucket").string(var_144);
    }
    if let Some(var_145) = &input.key_prefix {
        object.key("keyPrefix").string(var_145);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_recommendation_preferences(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::RecommendationPreferences,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_146) = &input.cpu_vendor_architectures {
        let mut array_147 = object.key("cpuVendorArchitectures").start_array();
        for item_148 in var_146 {
            {
                array_147.value().string(item_148.as_str());
            }
        }
        array_147.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_ebs_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::EbsFilter,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_149) = &input.name {
        object.key("name").string(var_149.as_str());
    }
    if let Some(var_150) = &input.values {
        let mut array_151 = object.key("values").start_array();
        for item_152 in var_150 {
            {
                array_151.value().string(item_152);
            }
        }
        array_151.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_lambda_function_recommendation_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::LambdaFunctionRecommendationFilter,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_153) = &input.name {
        object.key("name").string(var_153.as_str());
    }
    if let Some(var_154) = &input.values {
        let mut array_155 = object.key("values").start_array();
        for item_156 in var_154 {
            {
                array_155.value().string(item_156);
            }
        }
        array_155.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_enrollment_filter(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::EnrollmentFilter,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_157) = &input.name {
        object.key("name").string(var_157.as_str());
    }
    if let Some(var_158) = &input.values {
        let mut array_159 = object.key("values").start_array();
        for item_160 in var_158 {
            {
                array_159.value().string(item_160);
            }
        }
        array_159.finish();
    }
    Ok(())
}
