// chrome/browser/geic/geic.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 CHROME_BROWSER_GEIC_GEIC_MOJOM_DATA_VIEW_H_
#define CHROME_BROWSER_GEIC_GEIC_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 "chrome/browser/geic/geic.mojom-shared-internal.h"
#include "chrome/browser/pwc/pwc_features.mojom-shared.h"
#include "mojo/public/mojom/base/string16.mojom-shared.h"
#include "url/mojom/url.mojom-shared.h"


namespace geic::mojom {
class TabMetadataDataView;

class NoFocusedTabDataDataView;

class GeicInitialStateDataView;

class TabContextOptionsDataView;

class TabContextDataDataView;

class FocusedTabDataDataView;
class GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_ResultDataView;


}  // geic::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::geic::mojom::TabMetadataDataView> {
  using Data = ::geic::mojom::internal::TabMetadata_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::geic::mojom::NoFocusedTabDataDataView> {
  using Data = ::geic::mojom::internal::NoFocusedTabData_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::geic::mojom::GeicInitialStateDataView> {
  using Data = ::geic::mojom::internal::GeicInitialState_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::geic::mojom::TabContextOptionsDataView> {
  using Data = ::geic::mojom::internal::TabContextOptions_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::geic::mojom::TabContextDataDataView> {
  using Data = ::geic::mojom::internal::TabContextData_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::geic::mojom::FocusedTabDataDataView> {
  using Data = ::geic::mojom::internal::FocusedTabData_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::geic::mojom::GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_ResultDataView> {
  using Data = ::geic::mojom::internal::GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_Result_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

}  // namespace internal
}  // namespace mojo


namespace geic::mojom {


enum class GetTabContextError : int32_t {
  
  kUnknown = 0,
  
  kTabClosed = 1,
  
  kNavigationInProgress = 2,
  
  kPermissionDenied = 3,
  
  kInternalError = 4,
  kMinValue = 0,
  kMaxValue = 4,
  kDefaultValue = 0
};

 std::ostream& operator<<(std::ostream& os, GetTabContextError value);
inline bool IsKnownEnumValue(GetTabContextError value) {
  return internal::GetTabContextError_Data::IsKnownValue(
      static_cast<int32_t>(value));
}
inline GetTabContextError ToKnownEnumValue(GetTabContextError value) {
  if (IsKnownEnumValue(value)) {
    return value;
  }
  return GetTabContextError::kDefaultValue;
}

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

using GeicApiPtrDataView =
    mojo::InterfacePtrDataView<GeicApiInterfaceBase>;
using GeicApiRequestDataView =
    mojo::InterfaceRequestDataView<GeicApiInterfaceBase>;
using GeicApiAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<GeicApiInterfaceBase>;
using GeicApiAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<GeicApiInterfaceBase>;
class GeicBrowserHostInterfaceBase {};

using GeicBrowserHostPtrDataView =
    mojo::InterfacePtrDataView<GeicBrowserHostInterfaceBase>;
using GeicBrowserHostRequestDataView =
    mojo::InterfaceRequestDataView<GeicBrowserHostInterfaceBase>;
using GeicBrowserHostAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<GeicBrowserHostInterfaceBase>;
using GeicBrowserHostAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<GeicBrowserHostInterfaceBase>;
class GeicClientInterfaceBase {};

using GeicClientPtrDataView =
    mojo::InterfacePtrDataView<GeicClientInterfaceBase>;
using GeicClientRequestDataView =
    mojo::InterfaceRequestDataView<GeicClientInterfaceBase>;
using GeicClientAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<GeicClientInterfaceBase>;
using GeicClientAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<GeicClientInterfaceBase>;


class TabMetadataDataView {
 public:
  TabMetadataDataView() = default;

  TabMetadataDataView(
      internal::TabMetadata_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  int32_t tab_id() const {
    return data_->tab_id;
  }
  int32_t window_id() const {
    return data_->window_id;
  }
  inline void GetUrlDataView(
      ::url::mojom::UrlDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadUrl(UserType* output) {
    
    auto* pointer = data_->url.Get();
    return mojo::internal::Deserialize<::url::mojom::UrlDataView>(
        pointer, output, message_);
  }
  inline void GetTitleDataView(
      ::mojo_base::mojom::String16DataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadTitle(UserType* output) {
    
    auto* pointer = data_->title.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::String16DataView>(
        pointer, output, message_);
  }
  inline void GetFaviconDataView(
      mojo::ArrayDataView<uint8_t>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadFavicon(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::ArrayDataView<uint8_t>, UserType>(),
    "Attempting to read the optional `favicon` 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 `MaybeReadFavicon` instead "
    "of `ReadFavicon if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->favicon.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>(
        pointer, output, message_);
  }
  bool is_active_in_window() const {
    return data_->is_active_in_window;
  }
 private:
  internal::TabMetadata_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class NoFocusedTabDataDataView {
 public:
  NoFocusedTabDataDataView() = default;

  NoFocusedTabDataDataView(
      internal::NoFocusedTabData_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

  template <typename UserType>
  [[nodiscard]] bool ReadNoFocusReason(UserType* output) {
    
    auto* pointer = data_->no_focus_reason.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
 private:
  internal::NoFocusedTabData_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class GeicInitialStateDataView {
 public:
  GeicInitialStateDataView() = default;

  GeicInitialStateDataView(
      internal::GeicInitialState_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetFocusedTabDataDataView(
      FocusedTabDataDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadFocusedTabData(UserType* output) {
    
    auto* pointer = !data_->focused_tab_data.is_null() ? &data_->focused_tab_data : nullptr;
    return mojo::internal::Deserialize<::geic::mojom::FocusedTabDataDataView>(
        pointer, output, message_);
  }
 private:
  internal::GeicInitialState_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class TabContextOptionsDataView {
 public:
  TabContextOptionsDataView() = default;

  TabContextOptionsDataView(
      internal::TabContextOptions_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  bool include_inner_text() const {
    return data_->include_inner_text;
  }
  uint32_t inner_text_bytes_limit() const {
    return data_->inner_text_bytes_limit;
  }
  bool include_screenshot() const {
    return data_->include_screenshot;
  }
  uint32_t screenshot_max_width() const {
    return data_->screenshot_max_width;
  }
  uint32_t screenshot_max_height() const {
    return data_->screenshot_max_height;
  }
 private:
  internal::TabContextOptions_Data* data_ = nullptr;
};


class TabContextDataDataView {
 public:
  TabContextDataDataView() = default;

  TabContextDataDataView(
      internal::TabContextData_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetMetadataDataView(
      TabMetadataDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadMetadata(UserType* output) {
    
    auto* pointer = data_->metadata.Get();
    return mojo::internal::Deserialize<::geic::mojom::TabMetadataDataView>(
        pointer, output, message_);
  }
  inline void GetInnerTextDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadInnerText(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::StringDataView, UserType>(),
    "Attempting to read the optional `inner_text` 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 `MaybeReadInnerText` instead "
    "of `ReadInnerText if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->inner_text.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetScreenshotDataDataView(
      mojo::ArrayDataView<uint8_t>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadScreenshotData(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::ArrayDataView<uint8_t>, UserType>(),
    "Attempting to read the optional `screenshot_data` 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 `MaybeReadScreenshotData` instead "
    "of `ReadScreenshotData if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->screenshot_data.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>(
        pointer, output, message_);
  }
  inline void GetScreenshotMimeTypeDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadScreenshotMimeType(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::StringDataView, UserType>(),
    "Attempting to read the optional `screenshot_mime_type` 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 `MaybeReadScreenshotMimeType` instead "
    "of `ReadScreenshotMimeType if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->screenshot_mime_type.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
 private:
  internal::TabContextData_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class FocusedTabDataDataView {
 public:
  using Tag = internal::FocusedTabData_Data::FocusedTabData_Tag;

  FocusedTabDataDataView() = default;

  FocusedTabDataDataView(
      internal::FocusedTabData_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const {
    // For inlined unions, |data_| is always non-null. In that case we need to
    // check |data_->is_null()|.
    return !data_ || data_->is_null();
  }

  Tag tag() const { return data_->tag; }
  bool is_focused_tab() const { return data_->tag == Tag::kFocusedTab; }
  inline void GetFocusedTabDataView(
      TabMetadataDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFocusedTab(UserType* output) const {
    
    CHECK(is_focused_tab());
    return mojo::internal::Deserialize<::geic::mojom::TabMetadataDataView>(
        data_->data.f_focused_tab.Get(), output, message_);
  }
  bool is_no_focused_tab_data() const { return data_->tag == Tag::kNoFocusedTabData; }
  inline void GetNoFocusedTabDataDataView(
      NoFocusedTabDataDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadNoFocusedTabData(UserType* output) const {
    
    CHECK(is_no_focused_tab_data());
    return mojo::internal::Deserialize<::geic::mojom::NoFocusedTabDataDataView>(
        data_->data.f_no_focused_tab_data.Get(), output, message_);
  }

 private:
  internal::FocusedTabData_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};



class GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_ResultDataView {
 public:
  using Tag = internal::GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_Result_Data::GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_Result_Tag;

  GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_ResultDataView() = default;

  GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_ResultDataView(
      internal::GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_Result_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const {
    // For inlined unions, |data_| is always non-null. In that case we need to
    // check |data_->is_null()|.
    return !data_ || data_->is_null();
  }

  Tag tag() const { return data_->tag; }
  bool is_success() const { return data_->tag == Tag::kSuccess; }
  inline void GetSuccessDataView(
      TabContextDataDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadSuccess(UserType* output) const {
    
    CHECK(is_success());
    return mojo::internal::Deserialize<::geic::mojom::TabContextDataDataView>(
        data_->data.f_success.Get(), output, message_);
  }
  bool is_failure() const { return data_->tag == Tag::kFailure; }
  template <typename UserType>
  [[nodiscard]] bool ReadFailure(UserType* output) const {
    CHECK(is_failure());
    return mojo::internal::Deserialize<::geic::mojom::GetTabContextError>(
        data_->data.f_failure, output);
  }
  GetTabContextError failure() const {
    CHECK(is_failure());
    // TODO(dcheng): This seems incorrect, as it bypasses enum traits.
    return ::mojo::internal::ToKnownEnumValueHelper(
        static_cast<::geic::mojom::GetTabContextError>(data_->data.f_failure));
  }

 private:
  internal::GeicBrowserHost_GetContextFromFocusedTab_ResponseParam_Result_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};



}  // geic::mojom

#endif  // CHROME_BROWSER_GEIC_GEIC_MOJOM_DATA_VIEW_H_