// media/mojo/mojom/speech_recognition_error.mojom-data-view.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef MEDIA_MOJO_MOJOM_SPEECH_RECOGNITION_ERROR_MOJOM_DATA_VIEW_H_
#define MEDIA_MOJO_MOJOM_SPEECH_RECOGNITION_ERROR_MOJOM_DATA_VIEW_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "media/mojo/mojom/speech_recognition_error.mojom-shared-internal.h"
#include "media/mojo/mojom/speech_recognition_error_code.mojom-shared.h"


namespace media::mojom {
class SpeechRecognitionErrorDataView;



}  // media::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::media::mojom::SpeechRecognitionErrorDataView> {
  using Data = ::media::mojom::internal::SpeechRecognitionError_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace media::mojom {


enum class SpeechAudioErrorDetails : int32_t {
  
  kNone = 0,
  
  kNoMic = 1,
  kMinValue = 0,
  kMaxValue = 1,
};

 std::ostream& operator<<(std::ostream& os, SpeechAudioErrorDetails value);
inline bool IsKnownEnumValue(SpeechAudioErrorDetails value) {
  return internal::SpeechAudioErrorDetails_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(SpeechAudioErrorDetails) {
  return true;
}


class SpeechRecognitionErrorDataView {
 public:
  SpeechRecognitionErrorDataView() = default;

  SpeechRecognitionErrorDataView(
      internal::SpeechRecognitionError_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  template <typename UserType>
  [[nodiscard]] bool ReadCode(UserType* output) const {
    auto data_value = data_->code;
    return mojo::internal::Deserialize<::media::mojom::SpeechRecognitionErrorCode>(
        data_value, output);
  }
  ::media::mojom::SpeechRecognitionErrorCode code() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::media::mojom::SpeechRecognitionErrorCode>(data_->code));
  }
  template <typename UserType>
  [[nodiscard]] bool ReadDetails(UserType* output) const {
    auto data_value = data_->details;
    return mojo::internal::Deserialize<::media::mojom::SpeechAudioErrorDetails>(
        data_value, output);
  }
  SpeechAudioErrorDetails details() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::media::mojom::SpeechAudioErrorDetails>(data_->details));
  }
 private:
  internal::SpeechRecognitionError_Data* data_ = nullptr;
};


}  // media::mojom

#endif  // MEDIA_MOJO_MOJOM_SPEECH_RECOGNITION_ERROR_MOJOM_DATA_VIEW_H_