// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_content_identification_type_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<crate::types::MedicalContentIdentificationType>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-content-identification-type");
    ::aws_smithy_http::header::one_or_none(headers)
}

pub(crate) fn de_enable_channel_identification_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-enable-channel-identification");
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
    if var_1.len() > 1 {
        Err(::aws_smithy_http::header::ParseError::new(format!(
            "expected one item but found {}",
            var_1.len()
        )))
    } else {
        let mut var_1 = var_1;
        Ok(var_1.pop())
    }
}

pub(crate) fn de_language_code_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<crate::types::LanguageCode>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-language-code");
    ::aws_smithy_http::header::one_or_none(headers)
}

pub(crate) fn de_media_encoding_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<crate::types::MediaEncoding>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-media-encoding");
    ::aws_smithy_http::header::one_or_none(headers)
}

pub(crate) fn de_media_sample_rate_hertz_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-sample-rate");
    let var_2 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
    if var_2.len() > 1 {
        Err(::aws_smithy_http::header::ParseError::new(format!(
            "expected one item but found {}",
            var_2.len()
        )))
    } else {
        let mut var_2 = var_2;
        Ok(var_2.pop())
    }
}

pub(crate) fn de_number_of_channels_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-number-of-channels");
    let var_3 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
    if var_3.len() > 1 {
        Err(::aws_smithy_http::header::ParseError::new(format!(
            "expected one item but found {}",
            var_3.len()
        )))
    } else {
        let mut var_3 = var_3;
        Ok(var_3.pop())
    }
}

pub(crate) fn de_request_id_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-request-id");
    ::aws_smithy_http::header::one_or_none(headers)
}

pub(crate) fn de_session_id_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-session-id");
    ::aws_smithy_http::header::one_or_none(headers)
}

pub(crate) fn de_show_speaker_label_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-show-speaker-label");
    let var_4 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
    if var_4.len() > 1 {
        Err(::aws_smithy_http::header::ParseError::new(format!(
            "expected one item but found {}",
            var_4.len()
        )))
    } else {
        let mut var_4 = var_4;
        Ok(var_4.pop())
    }
}

pub(crate) fn de_specialty_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<crate::types::Specialty>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-specialty");
    ::aws_smithy_http::header::one_or_none(headers)
}

pub fn de_transcript_result_stream_payload(
    body: &mut ::aws_smithy_types::body::SdkBody,
) -> std::result::Result<
    crate::event_receiver::EventReceiver<crate::types::MedicalTranscriptResultStream, crate::types::error::MedicalTranscriptResultStreamError>,
    crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError,
> {
    let unmarshaller = crate::event_stream_serde::MedicalTranscriptResultStreamUnmarshaller::new();
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
    Ok(receiver)
}

pub(crate) fn de_type_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<crate::types::Type>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-type");
    ::aws_smithy_http::header::one_or_none(headers)
}

pub(crate) fn de_vocabulary_name_header(
    header_map: &::aws_smithy_runtime_api::http::Headers,
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    let headers = header_map.get_all("x-amzn-transcribe-vocabulary-name");
    ::aws_smithy_http::header::one_or_none(headers)
}
