// components/browser_apis/bookmarks/bookmarks_api.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 COMPONENTS_BROWSER_APIS_BOOKMARKS_BOOKMARKS_API_MOJOM_DATA_VIEW_H_
#define COMPONENTS_BROWSER_APIS_BOOKMARKS_BOOKMARKS_API_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 "components/browser_apis/bookmarks/bookmarks_api.mojom-shared-internal.h"
#include "mojo/public/mojom/base/empty.mojom-shared.h"
#include "mojo/public/mojom/base/error.mojom-shared.h"
#include "mojo/public/mojom/base/uuid.mojom-shared.h"
#include "url/mojom/url.mojom-shared.h"


namespace bookmarks_api::mojom {
class LegacyFieldsDataView;

class RootNodeDataView;

class UrlDataView;

class FolderDataView;

class BookmarksSnapshotDataView;

class BookmarkNodeCreatedDataView;

class BookmarkNodeRemovedDataView;

class BookmarkNodeMovedDataView;

class BookmarkNodeChangedDataView;

class BookmarkNodeDataView;
class BookmarksEventDataView;
class BookmarksService_GetBookmarks_ResponseParam_ResultDataView;
class BookmarksService_GetBookmark_ResponseParam_ResultDataView;
class BookmarksService_CreateBookmarkNode_ResponseParam_ResultDataView;
class BookmarksService_UpdateBookmarkNode_ResponseParam_ResultDataView;
class BookmarksService_MoveBookmarkNode_ResponseParam_ResultDataView;
class BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultDataView;


}  // bookmarks_api::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::LegacyFieldsDataView> {
  using Data = ::bookmarks_api::mojom::internal::LegacyFields_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::RootNodeDataView> {
  using Data = ::bookmarks_api::mojom::internal::RootNode_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::UrlDataView> {
  using Data = ::bookmarks_api::mojom::internal::Url_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::FolderDataView> {
  using Data = ::bookmarks_api::mojom::internal::Folder_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksSnapshotDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksSnapshot_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarkNodeCreatedDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarkNodeCreated_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarkNodeRemovedDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarkNodeRemoved_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarkNodeMovedDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarkNodeMoved_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarkNodeChangedDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarkNodeChanged_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarkNodeDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarkNode_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksEventDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksEvent_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksService_GetBookmarks_ResponseParam_ResultDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksService_GetBookmarks_ResponseParam_Result_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksService_GetBookmark_ResponseParam_ResultDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksService_GetBookmark_ResponseParam_Result_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksService_CreateBookmarkNode_ResponseParam_ResultDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksService_CreateBookmarkNode_ResponseParam_Result_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksService_UpdateBookmarkNode_ResponseParam_ResultDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksService_UpdateBookmarkNode_ResponseParam_Result_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksService_MoveBookmarkNode_ResponseParam_ResultDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksService_MoveBookmarkNode_ResponseParam_Result_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

template <>
struct MojomTypeTraits<::bookmarks_api::mojom::BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultDataView> {
  using Data = ::bookmarks_api::mojom::internal::BookmarksService_DeleteBookmarkNodes_ResponseParam_Result_Data;
  using DataAsArrayElement = Data;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};

}  // namespace internal
}  // namespace mojo


namespace bookmarks_api::mojom {


enum class PermanentFolderType : int32_t {
  
  kUnknown = 0,
  
  kBookmarkBar = 1,
  
  kOther = 2,
  
  kMobile = 3,
  
  kManaged = 4,
  kMinValue = 0,
  kMaxValue = 4,
};

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

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

using BookmarksObserverPtrDataView =
    mojo::InterfacePtrDataView<BookmarksObserverInterfaceBase>;
using BookmarksObserverRequestDataView =
    mojo::InterfaceRequestDataView<BookmarksObserverInterfaceBase>;
using BookmarksObserverAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<BookmarksObserverInterfaceBase>;
using BookmarksObserverAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<BookmarksObserverInterfaceBase>;
class BookmarksServiceInterfaceBase {};

using BookmarksServicePtrDataView =
    mojo::InterfacePtrDataView<BookmarksServiceInterfaceBase>;
using BookmarksServiceRequestDataView =
    mojo::InterfaceRequestDataView<BookmarksServiceInterfaceBase>;
using BookmarksServiceAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<BookmarksServiceInterfaceBase>;
using BookmarksServiceAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<BookmarksServiceInterfaceBase>;


class LegacyFieldsDataView {
 public:
  LegacyFieldsDataView() = default;

  LegacyFieldsDataView(
      internal::LegacyFields_Data* data,
      mojo::Message* message)
      : data_(data) {}

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

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


class RootNodeDataView {
 public:
  RootNodeDataView() = default;

  RootNodeDataView(
      internal::RootNode_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

  template <typename UserType>
  [[nodiscard]] bool ReadId(UserType* output) {
    
    auto* pointer = data_->id.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::UuidDataView>(
        pointer, output, message_);
  }
  inline void GetChildrenDataView(
      mojo::ArrayDataView<FolderDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadChildren(UserType* output) {
    
    auto* pointer = data_->children.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::bookmarks_api::mojom::FolderDataView>>(
        pointer, output, message_);
  }
 private:
  internal::RootNode_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class UrlDataView {
 public:
  UrlDataView() = default;

  UrlDataView(
      internal::Url_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

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

  template <typename UserType>
  [[nodiscard]] bool ReadLegacy(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::bookmarks_api::mojom::LegacyFieldsDataView, UserType>(),
    "Attempting to read the optional `legacy` 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 `MaybeReadLegacy` instead "
    "of `ReadLegacy if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->legacy.Get();
    return mojo::internal::Deserialize<::bookmarks_api::mojom::LegacyFieldsDataView>(
        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_);
  }
  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 GetFaviconUrlDataView(
      ::url::mojom::UrlDataView* output);

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


class FolderDataView {
 public:
  FolderDataView() = default;

  FolderDataView(
      internal::Folder_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

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

  template <typename UserType>
  [[nodiscard]] bool ReadLegacy(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::bookmarks_api::mojom::LegacyFieldsDataView, UserType>(),
    "Attempting to read the optional `legacy` 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 `MaybeReadLegacy` instead "
    "of `ReadLegacy if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->legacy.Get();
    return mojo::internal::Deserialize<::bookmarks_api::mojom::LegacyFieldsDataView>(
        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_);
  }
  inline void GetChildrenDataView(
      mojo::ArrayDataView<BookmarkNodeDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadChildren(UserType* output) {
    
    auto* pointer = data_->children.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::bookmarks_api::mojom::BookmarkNodeDataView>>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadPermanentFolderType(UserType* output) const {
    if (!data_->permanent_folder_type_$flag) {
      *output = std::nullopt;
      return true;
    }

    return mojo::internal::Deserialize<::bookmarks_api::mojom::PermanentFolderType>(
        data_->permanent_folder_type_$value, &output->emplace());
  }
  std::optional<PermanentFolderType> permanent_folder_type() const {
    if (!data_->permanent_folder_type_$flag) {
      return std::nullopt;
    }
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::bookmarks_api::mojom::PermanentFolderType>(data_->permanent_folder_type_$value));
  }
  bool is_synced() const {
    return data_->is_synced;
  }
 private:
  internal::Folder_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class BookmarksSnapshotDataView {
 public:
  BookmarksSnapshotDataView() = default;

  BookmarksSnapshotDataView(
      internal::BookmarksSnapshot_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetRootDataView(
      RootNodeDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadRoot(UserType* output) {
    
    auto* pointer = data_->root.Get();
    return mojo::internal::Deserialize<::bookmarks_api::mojom::RootNodeDataView>(
        pointer, output, message_);
  }
  template <typename UserType>
  UserType TakeStream() {
    UserType result;
    bool ret =
        mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarksObserverAssociatedRequestDataView>(
            &data_->stream, &result, message_);
    DCHECK(ret);
    return result;
  }
 private:
  internal::BookmarksSnapshot_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class BookmarkNodeCreatedDataView {
 public:
  BookmarkNodeCreatedDataView() = default;

  BookmarkNodeCreatedDataView(
      internal::BookmarkNodeCreated_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

  template <typename UserType>
  [[nodiscard]] bool ReadParentId(UserType* output) {
    
    auto* pointer = data_->parent_id.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::UuidDataView>(
        pointer, output, message_);
  }
  int32_t index() const {
    return data_->index;
  }
  inline void GetNodeDataView(
      BookmarkNodeDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadNode(UserType* output) {
    
    auto* pointer = !data_->node.is_null() ? &data_->node : nullptr;
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeDataView>(
        pointer, output, message_);
  }
 private:
  internal::BookmarkNodeCreated_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class BookmarkNodeRemovedDataView {
 public:
  BookmarkNodeRemovedDataView() = default;

  BookmarkNodeRemovedDataView(
      internal::BookmarkNodeRemoved_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

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


class BookmarkNodeMovedDataView {
 public:
  BookmarkNodeMovedDataView() = default;

  BookmarkNodeMovedDataView(
      internal::BookmarkNodeMoved_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

  template <typename UserType>
  [[nodiscard]] bool ReadOldParentId(UserType* output) {
    
    auto* pointer = data_->old_parent_id.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::UuidDataView>(
        pointer, output, message_);
  }
  int32_t old_index() const {
    return data_->old_index;
  }
  inline void GetNewParentIdDataView(
      ::mojo_base::mojom::UuidDataView* output);

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


class BookmarkNodeChangedDataView {
 public:
  BookmarkNodeChangedDataView() = default;

  BookmarkNodeChangedDataView(
      internal::BookmarkNodeChanged_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetNodeDataView(
      BookmarkNodeDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadNode(UserType* output) {
    
    auto* pointer = !data_->node.is_null() ? &data_->node : nullptr;
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeDataView>(
        pointer, output, message_);
  }
 private:
  internal::BookmarkNodeChanged_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class BookmarkNodeDataView {
 public:
  using Tag = internal::BookmarkNode_Data::BookmarkNode_Tag;

  BookmarkNodeDataView() = default;

  BookmarkNodeDataView(
      internal::BookmarkNode_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_url() const { return data_->tag == Tag::kUrl; }
  inline void GetUrlDataView(
      UrlDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadUrl(UserType* output) const {
    
    CHECK(is_url());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::UrlDataView>(
        data_->data.f_url.Get(), output, message_);
  }
  bool is_folder() const { return data_->tag == Tag::kFolder; }
  inline void GetFolderDataView(
      FolderDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFolder(UserType* output) const {
    
    CHECK(is_folder());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::FolderDataView>(
        data_->data.f_folder.Get(), output, message_);
  }

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



class BookmarksEventDataView {
 public:
  using Tag = internal::BookmarksEvent_Data::BookmarksEvent_Tag;

  BookmarksEventDataView() = default;

  BookmarksEventDataView(
      internal::BookmarksEvent_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_added() const { return data_->tag == Tag::kAdded; }
  inline void GetAddedDataView(
      BookmarkNodeCreatedDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadAdded(UserType* output) const {
    
    CHECK(is_added());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeCreatedDataView>(
        data_->data.f_added.Get(), output, message_);
  }
  bool is_removed() const { return data_->tag == Tag::kRemoved; }
  inline void GetRemovedDataView(
      BookmarkNodeRemovedDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadRemoved(UserType* output) const {
    
    CHECK(is_removed());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeRemovedDataView>(
        data_->data.f_removed.Get(), output, message_);
  }
  bool is_moved() const { return data_->tag == Tag::kMoved; }
  inline void GetMovedDataView(
      BookmarkNodeMovedDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadMoved(UserType* output) const {
    
    CHECK(is_moved());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeMovedDataView>(
        data_->data.f_moved.Get(), output, message_);
  }
  bool is_changed() const { return data_->tag == Tag::kChanged; }
  inline void GetChangedDataView(
      BookmarkNodeChangedDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadChanged(UserType* output) const {
    
    CHECK(is_changed());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeChangedDataView>(
        data_->data.f_changed.Get(), output, message_);
  }

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



class BookmarksService_GetBookmarks_ResponseParam_ResultDataView {
 public:
  using Tag = internal::BookmarksService_GetBookmarks_ResponseParam_Result_Data::BookmarksService_GetBookmarks_ResponseParam_Result_Tag;

  BookmarksService_GetBookmarks_ResponseParam_ResultDataView() = default;

  BookmarksService_GetBookmarks_ResponseParam_ResultDataView(
      internal::BookmarksService_GetBookmarks_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(
      BookmarksSnapshotDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadSuccess(UserType* output) const {
    
    CHECK(is_success());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarksSnapshotDataView>(
        data_->data.f_success.Get(), output, message_);
  }
  bool is_failure() const { return data_->tag == Tag::kFailure; }
  inline void GetFailureDataView(
      ::mojo_base::mojom::ErrorDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFailure(UserType* output) const {
    
    CHECK(is_failure());
    return mojo::internal::Deserialize<::mojo_base::mojom::ErrorDataView>(
        data_->data.f_failure.Get(), output, message_);
  }

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



class BookmarksService_GetBookmark_ResponseParam_ResultDataView {
 public:
  using Tag = internal::BookmarksService_GetBookmark_ResponseParam_Result_Data::BookmarksService_GetBookmark_ResponseParam_Result_Tag;

  BookmarksService_GetBookmark_ResponseParam_ResultDataView() = default;

  BookmarksService_GetBookmark_ResponseParam_ResultDataView(
      internal::BookmarksService_GetBookmark_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(
      BookmarkNodeDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadSuccess(UserType* output) const {
    
    CHECK(is_success());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeDataView>(
        data_->data.f_success.Get(), output, message_);
  }
  bool is_failure() const { return data_->tag == Tag::kFailure; }
  inline void GetFailureDataView(
      ::mojo_base::mojom::ErrorDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFailure(UserType* output) const {
    
    CHECK(is_failure());
    return mojo::internal::Deserialize<::mojo_base::mojom::ErrorDataView>(
        data_->data.f_failure.Get(), output, message_);
  }

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



class BookmarksService_CreateBookmarkNode_ResponseParam_ResultDataView {
 public:
  using Tag = internal::BookmarksService_CreateBookmarkNode_ResponseParam_Result_Data::BookmarksService_CreateBookmarkNode_ResponseParam_Result_Tag;

  BookmarksService_CreateBookmarkNode_ResponseParam_ResultDataView() = default;

  BookmarksService_CreateBookmarkNode_ResponseParam_ResultDataView(
      internal::BookmarksService_CreateBookmarkNode_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(
      BookmarkNodeDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadSuccess(UserType* output) const {
    
    CHECK(is_success());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeDataView>(
        data_->data.f_success.Get(), output, message_);
  }
  bool is_failure() const { return data_->tag == Tag::kFailure; }
  inline void GetFailureDataView(
      ::mojo_base::mojom::ErrorDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFailure(UserType* output) const {
    
    CHECK(is_failure());
    return mojo::internal::Deserialize<::mojo_base::mojom::ErrorDataView>(
        data_->data.f_failure.Get(), output, message_);
  }

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



class BookmarksService_UpdateBookmarkNode_ResponseParam_ResultDataView {
 public:
  using Tag = internal::BookmarksService_UpdateBookmarkNode_ResponseParam_Result_Data::BookmarksService_UpdateBookmarkNode_ResponseParam_Result_Tag;

  BookmarksService_UpdateBookmarkNode_ResponseParam_ResultDataView() = default;

  BookmarksService_UpdateBookmarkNode_ResponseParam_ResultDataView(
      internal::BookmarksService_UpdateBookmarkNode_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(
      BookmarkNodeDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadSuccess(UserType* output) const {
    
    CHECK(is_success());
    return mojo::internal::Deserialize<::bookmarks_api::mojom::BookmarkNodeDataView>(
        data_->data.f_success.Get(), output, message_);
  }
  bool is_failure() const { return data_->tag == Tag::kFailure; }
  inline void GetFailureDataView(
      ::mojo_base::mojom::ErrorDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFailure(UserType* output) const {
    
    CHECK(is_failure());
    return mojo::internal::Deserialize<::mojo_base::mojom::ErrorDataView>(
        data_->data.f_failure.Get(), output, message_);
  }

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



class BookmarksService_MoveBookmarkNode_ResponseParam_ResultDataView {
 public:
  using Tag = internal::BookmarksService_MoveBookmarkNode_ResponseParam_Result_Data::BookmarksService_MoveBookmarkNode_ResponseParam_Result_Tag;

  BookmarksService_MoveBookmarkNode_ResponseParam_ResultDataView() = default;

  BookmarksService_MoveBookmarkNode_ResponseParam_ResultDataView(
      internal::BookmarksService_MoveBookmarkNode_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(
      ::mojo_base::mojom::EmptyDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadSuccess(UserType* output) const {
    
    CHECK(is_success());
    return mojo::internal::Deserialize<::mojo_base::mojom::EmptyDataView>(
        data_->data.f_success.Get(), output, message_);
  }
  bool is_failure() const { return data_->tag == Tag::kFailure; }
  inline void GetFailureDataView(
      ::mojo_base::mojom::ErrorDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFailure(UserType* output) const {
    
    CHECK(is_failure());
    return mojo::internal::Deserialize<::mojo_base::mojom::ErrorDataView>(
        data_->data.f_failure.Get(), output, message_);
  }

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



class BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultDataView {
 public:
  using Tag = internal::BookmarksService_DeleteBookmarkNodes_ResponseParam_Result_Data::BookmarksService_DeleteBookmarkNodes_ResponseParam_Result_Tag;

  BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultDataView() = default;

  BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultDataView(
      internal::BookmarksService_DeleteBookmarkNodes_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(
      ::mojo_base::mojom::EmptyDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadSuccess(UserType* output) const {
    
    CHECK(is_success());
    return mojo::internal::Deserialize<::mojo_base::mojom::EmptyDataView>(
        data_->data.f_success.Get(), output, message_);
  }
  bool is_failure() const { return data_->tag == Tag::kFailure; }
  inline void GetFailureDataView(
      ::mojo_base::mojom::ErrorDataView* output) const;

  template <typename UserType>
  [[nodiscard]] bool ReadFailure(UserType* output) const {
    
    CHECK(is_failure());
    return mojo::internal::Deserialize<::mojo_base::mojom::ErrorDataView>(
        data_->data.f_failure.Get(), output, message_);
  }

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



}  // bookmarks_api::mojom

#endif  // COMPONENTS_BROWSER_APIS_BOOKMARKS_BOOKMARKS_API_MOJOM_DATA_VIEW_H_