// third_party/blink/public/mojom/ai/ai_rewriter.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 THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_REWRITER_MOJOM_DATA_VIEW_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_REWRITER_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 "third_party/blink/public/mojom/ai/ai_rewriter.mojom-shared-internal.h"
#include "third_party/blink/public/mojom/ai/ai_common.mojom-shared.h"
#include "third_party/blink/public/mojom/ai/model_streaming_responder.mojom-shared.h"


namespace blink::mojom {
class AIRewriterCreateOptionsDataView;



}  // blink::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::blink::mojom::AIRewriterCreateOptionsDataView> {
  using Data = ::blink::mojom::internal::AIRewriterCreateOptions_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace blink::mojom {


enum class AIRewriterTone : int32_t {
  
  kAsIs = 0,
  
  kMoreFormal = 1,
  
  kMoreCasual = 2,
  kMinValue = 0,
  kMaxValue = 2,
};

COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) std::ostream& operator<<(std::ostream& os, AIRewriterTone value);
inline bool IsKnownEnumValue(AIRewriterTone value) {
  return internal::AIRewriterTone_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

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


enum class AIRewriterFormat : int32_t {
  
  kAsIs = 0,
  
  kPlainText = 1,
  
  kMarkdown = 2,
  kMinValue = 0,
  kMaxValue = 2,
};

COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) std::ostream& operator<<(std::ostream& os, AIRewriterFormat value);
inline bool IsKnownEnumValue(AIRewriterFormat value) {
  return internal::AIRewriterFormat_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

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


enum class AIRewriterLength : int32_t {
  
  kAsIs = 0,
  
  kShorter = 1,
  
  kLonger = 2,
  kMinValue = 0,
  kMaxValue = 2,
};

COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) std::ostream& operator<<(std::ostream& os, AIRewriterLength value);
inline bool IsKnownEnumValue(AIRewriterLength value) {
  return internal::AIRewriterLength_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(AIRewriterLength) {
  return true;
}
// Interface base classes. They are used for type safety check.
class AIRewriterInterfaceBase {};

using AIRewriterPtrDataView =
    mojo::InterfacePtrDataView<AIRewriterInterfaceBase>;
using AIRewriterRequestDataView =
    mojo::InterfaceRequestDataView<AIRewriterInterfaceBase>;
using AIRewriterAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<AIRewriterInterfaceBase>;
using AIRewriterAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<AIRewriterInterfaceBase>;


class AIRewriterCreateOptionsDataView {
 public:
  AIRewriterCreateOptionsDataView() = default;

  AIRewriterCreateOptionsDataView(
      internal::AIRewriterCreateOptions_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetSharedContextDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadSharedContext(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::StringDataView, UserType>(),
    "Attempting to read the optional `shared_context` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadSharedContext` instead "
    "of `ReadSharedContext if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->shared_context.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadTone(UserType* output) const {
    auto data_value = data_->tone;
    return mojo::internal::Deserialize<::blink::mojom::AIRewriterTone>(
        data_value, output);
  }
  AIRewriterTone tone() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::blink::mojom::AIRewriterTone>(data_->tone));
  }
  template <typename UserType>
  [[nodiscard]] bool ReadFormat(UserType* output) const {
    auto data_value = data_->format;
    return mojo::internal::Deserialize<::blink::mojom::AIRewriterFormat>(
        data_value, output);
  }
  AIRewriterFormat format() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::blink::mojom::AIRewriterFormat>(data_->format));
  }
  template <typename UserType>
  [[nodiscard]] bool ReadLength(UserType* output) const {
    auto data_value = data_->length;
    return mojo::internal::Deserialize<::blink::mojom::AIRewriterLength>(
        data_value, output);
  }
  AIRewriterLength length() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::blink::mojom::AIRewriterLength>(data_->length));
  }
  inline void GetExpectedInputLanguagesDataView(
      mojo::ArrayDataView<::blink::mojom::AILanguageCodeDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadExpectedInputLanguages(UserType* output) {
    
    auto* pointer = data_->expected_input_languages.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::blink::mojom::AILanguageCodeDataView>>(
        pointer, output, message_);
  }
  inline void GetExpectedContextLanguagesDataView(
      mojo::ArrayDataView<::blink::mojom::AILanguageCodeDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadExpectedContextLanguages(UserType* output) {
    
    auto* pointer = data_->expected_context_languages.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::blink::mojom::AILanguageCodeDataView>>(
        pointer, output, message_);
  }
  inline void GetOutputLanguageDataView(
      ::blink::mojom::AILanguageCodeDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadOutputLanguage(UserType* output) {
    
    auto* pointer = data_->output_language.Get();
    return mojo::internal::Deserialize<::blink::mojom::AILanguageCodeDataView>(
        pointer, output, message_);
  }
 private:
  internal::AIRewriterCreateOptions_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // blink::mojom

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_REWRITER_MOJOM_DATA_VIEW_H_