// chrome/browser/contextual_tasks/contextual_tasks.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_CONTEXTUAL_TASKS_CONTEXTUAL_TASKS_MOJOM_DATA_VIEW_H_
#define CHROME_BROWSER_CONTEXTUAL_TASKS_CONTEXTUAL_TASKS_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/contextual_tasks/contextual_tasks.mojom-shared-internal.h"
#include "mojo/public/mojom/base/uuid.mojom-shared.h"
#include "mojo/public/mojom/base/unguessable_token.mojom-shared.h"
#include "mojo/public/mojom/base/proto_wrapper.mojom-shared.h"
#include "url/mojom/url.mojom-shared.h"
#include "ui/base/mojom/window_open_disposition.mojom-shared.h"


namespace contextual_tasks::mojom {
class InjectedInputDataView;

class ContextualTaskIdDataView;

class ContextualWindowIdDataView;

class TabContextDataView;

class ImageContextDataView;

class FileContextDataView;

class ComposeboxPositionDataView;

class ContextInfoDataView;


}  // contextual_tasks::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::InjectedInputDataView> {
  using Data = ::contextual_tasks::mojom::internal::InjectedInput_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::ContextualTaskIdDataView> {
  using Data = ::contextual_tasks::mojom::internal::ContextualTaskId_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::ContextualWindowIdDataView> {
  using Data = ::contextual_tasks::mojom::internal::ContextualWindowId_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::TabContextDataView> {
  using Data = ::contextual_tasks::mojom::internal::TabContext_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::ImageContextDataView> {
  using Data = ::contextual_tasks::mojom::internal::ImageContext_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::FileContextDataView> {
  using Data = ::contextual_tasks::mojom::internal::FileContext_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::ComposeboxPositionDataView> {
  using Data = ::contextual_tasks::mojom::internal::ComposeboxPosition_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::contextual_tasks::mojom::ContextInfoDataView> {
  using Data = ::contextual_tasks::mojom::internal::ContextInfo_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

}  // namespace internal
}  // namespace mojo


namespace contextual_tasks::mojom {


enum class IconType : int32_t {
  
  kUnspecified = 0,
  
  kAdd = 9,
  
  kCheck = 30,
  
  kFormatQuoteFilled = 79,
  
  kImage = 84,
  
  kFollowUp = 100,
  
  kDrivePdf = 101,
  
  kInvertedFormatQuoteFilled = 186,
  kMinValue = 0,
  kMaxValue = 186,
};

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

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

using PageHandlerPtrDataView =
    mojo::InterfacePtrDataView<PageHandlerInterfaceBase>;
using PageHandlerRequestDataView =
    mojo::InterfaceRequestDataView<PageHandlerInterfaceBase>;
using PageHandlerAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<PageHandlerInterfaceBase>;
using PageHandlerAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<PageHandlerInterfaceBase>;
class PageInterfaceBase {};

using PagePtrDataView =
    mojo::InterfacePtrDataView<PageInterfaceBase>;
using PageRequestDataView =
    mojo::InterfaceRequestDataView<PageInterfaceBase>;
using PageAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<PageInterfaceBase>;
using PageAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<PageInterfaceBase>;
class PageHandlerFactoryInterfaceBase {};

using PageHandlerFactoryPtrDataView =
    mojo::InterfacePtrDataView<PageHandlerFactoryInterfaceBase>;
using PageHandlerFactoryRequestDataView =
    mojo::InterfaceRequestDataView<PageHandlerFactoryInterfaceBase>;
using PageHandlerFactoryAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<PageHandlerFactoryInterfaceBase>;
using PageHandlerFactoryAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<PageHandlerFactoryInterfaceBase>;
class ExtensionPageHandlerFactoryInterfaceBase {};

using ExtensionPageHandlerFactoryPtrDataView =
    mojo::InterfacePtrDataView<ExtensionPageHandlerFactoryInterfaceBase>;
using ExtensionPageHandlerFactoryRequestDataView =
    mojo::InterfaceRequestDataView<ExtensionPageHandlerFactoryInterfaceBase>;
using ExtensionPageHandlerFactoryAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ExtensionPageHandlerFactoryInterfaceBase>;
using ExtensionPageHandlerFactoryAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ExtensionPageHandlerFactoryInterfaceBase>;
class ExtensionPageHandlerInterfaceBase {};

using ExtensionPageHandlerPtrDataView =
    mojo::InterfacePtrDataView<ExtensionPageHandlerInterfaceBase>;
using ExtensionPageHandlerRequestDataView =
    mojo::InterfaceRequestDataView<ExtensionPageHandlerInterfaceBase>;
using ExtensionPageHandlerAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ExtensionPageHandlerInterfaceBase>;
using ExtensionPageHandlerAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ExtensionPageHandlerInterfaceBase>;
class ExtensionPageInterfaceBase {};

using ExtensionPagePtrDataView =
    mojo::InterfacePtrDataView<ExtensionPageInterfaceBase>;
using ExtensionPageRequestDataView =
    mojo::InterfaceRequestDataView<ExtensionPageInterfaceBase>;
using ExtensionPageAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ExtensionPageInterfaceBase>;
using ExtensionPageAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ExtensionPageInterfaceBase>;


class InjectedInputDataView {
 public:
  InjectedInputDataView() = default;

  InjectedInputDataView(
      internal::InjectedInput_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

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

  template <typename UserType>
  [[nodiscard]] bool ReadThumbnail(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::StringDataView, UserType>(),
    "Attempting to read the optional `thumbnail` 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 `MaybeReadThumbnail` instead "
    "of `ReadThumbnail if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->thumbnail.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadIconId(UserType* output) const {
    auto data_value = data_->icon_id;
    return mojo::internal::Deserialize<::contextual_tasks::mojom::IconType>(
        data_value, output);
  }
  IconType icon_id() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::contextual_tasks::mojom::IconType>(data_->icon_id));
  }
  inline void GetFileTokenDataView(
      ::mojo_base::mojom::UnguessableTokenDataView* output);

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

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


class ContextualTaskIdDataView {
 public:
  ContextualTaskIdDataView() = default;

  ContextualTaskIdDataView(
      internal::ContextualTaskId_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetValueDataView(
      ::mojo_base::mojom::UuidDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadValue(UserType* output) {
    
    auto* pointer = data_->value.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::UuidDataView>(
        pointer, output, message_);
  }
 private:
  internal::ContextualTaskId_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class ContextualWindowIdDataView {
 public:
  ContextualWindowIdDataView() = default;

  ContextualWindowIdDataView(
      internal::ContextualWindowId_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetValueDataView(
      ::mojo_base::mojom::UnguessableTokenDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadValue(UserType* output) {
    
    auto* pointer = data_->value.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::UnguessableTokenDataView>(
        pointer, output, message_);
  }
 private:
  internal::ContextualWindowId_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class TabContextDataView {
 public:
  TabContextDataView() = default;

  TabContextDataView(
      internal::TabContext_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  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::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadTitle(UserType* output) {
    
    auto* pointer = data_->title.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  int32_t tab_id() const {
    return data_->tab_id;
  }
  bool has_chrome_tab_data() const {
    return data_->has_chrome_tab_data;
  }
 private:
  internal::TabContext_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class ImageContextDataView {
 public:
  ImageContextDataView() = default;

  ImageContextDataView(
      internal::ImageContext_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  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::StringDataView* output);

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


class FileContextDataView {
 public:
  FileContextDataView() = default;

  FileContextDataView(
      internal::FileContext_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  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::StringDataView* output);

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


class ComposeboxPositionDataView {
 public:
  ComposeboxPositionDataView() = default;

  ComposeboxPositionDataView(
      internal::ComposeboxPosition_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  std::optional<uint32_t> max_width() const {

    return data_->max_width_$flag
        ? std::make_optional(data_->max_width_$value)
        : std::nullopt;
  }
  std::optional<uint32_t> max_height() const {

    return data_->max_height_$flag
        ? std::make_optional(data_->max_height_$value)
        : std::nullopt;
  }
  std::optional<int32_t> margin_bottom() const {

    return data_->margin_bottom_$flag
        ? std::make_optional(data_->margin_bottom_$value)
        : std::nullopt;
  }
  std::optional<int32_t> margin_left() const {

    return data_->margin_left_$flag
        ? std::make_optional(data_->margin_left_$value)
        : std::nullopt;
  }
 private:
  internal::ComposeboxPosition_Data* data_ = nullptr;
};


class ContextInfoDataView {
 public:
  using Tag = internal::ContextInfo_Data::ContextInfo_Tag;

  ContextInfoDataView() = default;

  ContextInfoDataView(
      internal::ContextInfo_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_tab() const { return data_->tag == Tag::kTab; }
  inline void GetTabDataView(
      TabContextDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadTab(UserType* output) const {
    
    CHECK(is_tab());
    return mojo::internal::Deserialize<::contextual_tasks::mojom::TabContextDataView>(
        data_->data.f_tab.Get(), output, message_);
  }
  bool is_image() const { return data_->tag == Tag::kImage; }
  inline void GetImageDataView(
      ImageContextDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadImage(UserType* output) const {
    
    CHECK(is_image());
    return mojo::internal::Deserialize<::contextual_tasks::mojom::ImageContextDataView>(
        data_->data.f_image.Get(), output, message_);
  }
  bool is_file() const { return data_->tag == Tag::kFile; }
  inline void GetFileDataView(
      FileContextDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFile(UserType* output) const {
    
    CHECK(is_file());
    return mojo::internal::Deserialize<::contextual_tasks::mojom::FileContextDataView>(
        data_->data.f_file.Get(), output, message_);
  }

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



}  // contextual_tasks::mojom

#endif  // CHROME_BROWSER_CONTEXTUAL_TASKS_CONTEXTUAL_TASKS_MOJOM_DATA_VIEW_H_