// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_structure_crate_input_create_inbound_x12_transaction_settings_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateInboundX12TransactionSettingsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_1) = &input.guide_id {
        object.key("guideId").string(var_1.as_str());
    }
    if let Some(var_2) = &input.release {
        object.key("release").string(var_2.as_str());
    }
    if let Some(var_3) = &input.transaction_set_identifier {
        object
            .key("transactionSetIdentifier")
            .string(var_3.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_outbound_x12_transaction_settings_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateOutboundX12TransactionSettingsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_4) = &input.bucket_connection {
        #[allow(unused_mut)]
        let mut object_5 = object.key("bucketConnection").start_object();
        crate::json_ser::serialize_structure_crate_model_x12_outbound_transaction_bucket_connection(&mut object_5, var_4)?;
        object_5.finish();
    }
    if let Some(var_6) = &input.guide_id {
        object.key("guideId").string(var_6.as_str());
    }
    if let Some(var_7) = &input.local_application_id {
        object.key("localApplicationId").string(var_7.as_str());
    }
    if let Some(var_8) = &input.partner_application_id {
        object.key("partnerApplicationId").string(var_8.as_str());
    }
    if let Some(var_9) = &input.release {
        object.key("release").string(var_9.as_str());
    }
    if let Some(var_10) = &input.transaction_set_identifier {
        object
            .key("transactionSetIdentifier")
            .string(var_10.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_x12_bucket_connection_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateX12BucketConnectionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_11) = &input.bucket_name {
        object.key("bucketName").string(var_11.as_str());
    }
    if let Some(var_12) = &input.inbound_subdirectory {
        object.key("inboundSubdirectory").string(var_12.as_str());
    }
    if let Some(var_13) = &input.outbound_subdirectory {
        object.key("outboundSubdirectory").string(var_13.as_str());
    }
    if let Some(var_14) = &input.parent_directory {
        object.key("parentDirectory").string(var_14.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_x12_partnership_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateX12PartnershipInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_15) = &input.interchange_usage_indicator {
        object
            .key("interchangeUsageIndicator")
            .string(var_15.as_str());
    }
    if let Some(var_16) = &input.local_profile_id {
        object.key("localProfileId").string(var_16.as_str());
    }
    if let Some(var_17) = &input.partner_profile_id {
        object.key("partnerProfileId").string(var_17.as_str());
    }
    if let Some(var_18) = &input.partnership_id {
        object.key("partnershipId").string(var_18.as_str());
    }
    if let Some(var_19) = &input.timezone {
        object.key("timezone").string(var_19.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_x12_profile_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateX12ProfileInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_20) = &input.application_identifiers {
        let mut array_21 = object.key("applicationIdentifiers").start_array();
        for item_22 in var_20 {
            {
                #[allow(unused_mut)]
                let mut object_23 = array_21.value().start_object();
                crate::json_ser::serialize_structure_crate_model_x12_application_id(
                    &mut object_23,
                    item_22,
                )?;
                object_23.finish();
            }
        }
        array_21.finish();
    }
    if let Some(var_24) = &input.interchange_id {
        object.key("interchangeId").string(var_24.as_str());
    }
    if let Some(var_25) = &input.interchange_qualifier {
        object.key("interchangeQualifier").string(var_25.as_str());
    }
    if let Some(var_26) = &input.profile_id {
        object.key("profileId").string(var_26.as_str());
    }
    if let Some(var_27) = &input.profile_type {
        object.key("profileType").string(var_27.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_generate_edi_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GenerateEdiInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_28) = &input.interchange_usage_indicator_override {
        object
            .key("interchangeUsageIndicatorOverride")
            .string(var_28.as_str());
    }
    if let Some(var_29) = &input.release {
        object.key("release").string(var_29.as_str());
    }
    if let Some(var_30) = &input.transaction_set_identifier {
        object
            .key("transactionSetIdentifier")
            .string(var_30.as_str());
    }
    if let Some(var_31) = &input.transactions {
        let mut array_32 = object.key("transactions").start_array();
        for item_33 in var_31 {
            {
                array_32.value().document(item_33);
            }
        }
        array_32.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_x12_partnership_by_interchanges_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetX12PartnershipByInterchangesInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_34) = &input.local_interchange_identifier {
        #[allow(unused_mut)]
        let mut object_35 = object.key("localInterchangeIdentifier").start_object();
        crate::json_ser::serialize_structure_crate_model_x12_interchange_identifier(
            &mut object_35,
            var_34,
        )?;
        object_35.finish();
    }
    if let Some(var_36) = &input.partner_interchange_identifier {
        #[allow(unused_mut)]
        let mut object_37 = object.key("partnerInterchangeIdentifier").start_object();
        crate::json_ser::serialize_structure_crate_model_x12_interchange_identifier(
            &mut object_37,
            var_36,
        )?;
        object_37.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_x12_profile_by_interchange_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetX12ProfileByInterchangeInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_38) = &input.interchange_identifier {
        #[allow(unused_mut)]
        let mut object_39 = object.key("interchangeIdentifier").start_object();
        crate::json_ser::serialize_structure_crate_model_x12_interchange_identifier(
            &mut object_39,
            var_38,
        )?;
        object_39.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_increment_x12_control_number_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::IncrementX12ControlNumberInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_40) = &input.control_number_type {
        object.key("controlNumberType").string(var_40.as_str());
    }
    if let Some(var_41) = &input.partnership_id {
        object.key("partnershipId").string(var_41.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_set_outbound_x12_control_number_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::SetOutboundX12ControlNumberInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_42) = &input.control_number_type {
        object.key("controlNumberType").string(var_42.as_str());
    }
    if let Some(var_43) = &input.x12_control_number {
        object.key("x12ControlNumber").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_43).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_inbound_x12_transaction_settings_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateInboundX12TransactionSettingsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_44) = &input.guide_id {
        object.key("guideId").string(var_44.as_str());
    }
    if let Some(var_45) = &input.release {
        object.key("release").string(var_45.as_str());
    }
    if let Some(var_46) = &input.transaction_set_identifier {
        object
            .key("transactionSetIdentifier")
            .string(var_46.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_outbound_x12_transaction_settings_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateOutboundX12TransactionSettingsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_47) = &input.bucket_connection {
        #[allow(unused_mut)]
        let mut object_48 = object.key("bucketConnection").start_object();
        crate::json_ser::serialize_structure_crate_model_x12_outbound_transaction_bucket_connection(&mut object_48, var_47)?;
        object_48.finish();
    }
    if let Some(var_49) = &input.guide_id {
        object.key("guideId").string(var_49.as_str());
    }
    if let Some(var_50) = &input.local_application_id {
        object.key("localApplicationId").string(var_50.as_str());
    }
    if let Some(var_51) = &input.partner_application_id {
        object.key("partnerApplicationId").string(var_51.as_str());
    }
    if let Some(var_52) = &input.release {
        object.key("release").string(var_52.as_str());
    }
    if let Some(var_53) = &input.transaction_set_identifier {
        object
            .key("transactionSetIdentifier")
            .string(var_53.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_x12_bucket_connection_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateX12BucketConnectionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_54) = &input.inbound_subdirectory {
        object.key("inboundSubdirectory").string(var_54.as_str());
    }
    if let Some(var_55) = &input.outbound_subdirectory {
        object.key("outboundSubdirectory").string(var_55.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_x12_partnership_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateX12PartnershipInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_56) = &input.interchange_usage_indicator {
        object
            .key("interchangeUsageIndicator")
            .string(var_56.as_str());
    }
    if let Some(var_57) = &input.timezone {
        object.key("timezone").string(var_57.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_x12_profile_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateX12ProfileInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_58) = &input.application_identifiers {
        let mut array_59 = object.key("applicationIdentifiers").start_array();
        for item_60 in var_58 {
            {
                #[allow(unused_mut)]
                let mut object_61 = array_59.value().start_object();
                crate::json_ser::serialize_structure_crate_model_x12_application_id(
                    &mut object_61,
                    item_60,
                )?;
                object_61.finish();
            }
        }
        array_59.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_x12_outbound_transaction_bucket_connection(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::X12OutboundTransactionBucketConnection,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_62) = &input.bucket_connection_id {
        object.key("bucketConnectionId").string(var_62.as_str());
    }
    if let Some(var_63) = &input.subdirectory {
        object.key("subdirectory").string(var_63.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_x12_application_id(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::X12ApplicationId,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_64) = &input.value {
        object.key("value").string(var_64.as_str());
    }
    if let Some(var_65) = &input.is_default {
        object.key("isDefault").boolean(*var_65);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_x12_interchange_identifier(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::X12InterchangeIdentifier,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_66) = &input.interchange_qualifier {
        object.key("interchangeQualifier").string(var_66.as_str());
    }
    if let Some(var_67) = &input.interchange_id {
        object.key("interchangeId").string(var_67.as_str());
    }
    Ok(())
}
