// components/browser_apis/tab_drag/tab_drag_api.mojom.h is auto generated by mojom_bindings_generator.py, do not edit

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

#ifndef COMPONENTS_BROWSER_APIS_TAB_DRAG_TAB_DRAG_API_MOJOM_H_
#define COMPONENTS_BROWSER_APIS_TAB_DRAG_TAB_DRAG_API_MOJOM_H_

#include <stdint.h>

#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"

#include "components/browser_apis/tab_drag/tab_drag_api.mojom-features.h"  // IWYU pragma: export
#include "components/browser_apis/tab_drag/tab_drag_api.mojom-shared.h"  // IWYU pragma: export
#include "components/browser_apis/tab_drag/tab_drag_api.mojom-forward.h"  // IWYU pragma: export
#include "components/browser_apis/tab_strip/tab_strip_api_types.mojom.h"
#include "mojo/public/mojom/base/empty.mojom.h"
#include "mojo/public/mojom/base/error.mojom.h"
#include "ui/gfx/geometry/mojom/geometry.mojom.h"
#include <string>
#include <vector>

#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"


#include "base/types/expected.h"




namespace tabs_api::mojom {

class TabDragServiceProxy;

template <typename ImplRefTraits>
class TabDragServiceStub;

class TabDragServiceRequestValidator;
class TabDragServiceResponseValidator;


class TabDragService
    : public TabDragServiceInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "tabs_api.mojom.TabDragService";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = true;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = TabDragServiceInterfaceBase;
  using Proxy_ = TabDragServiceProxy;

  template <typename ImplRefTraits>
  using Stub_ = TabDragServiceStub<ImplRefTraits>;

  using RequestValidator_ = TabDragServiceRequestValidator;
  using ResponseValidator_ = TabDragServiceResponseValidator;
  enum MethodMinVersions : uint32_t {
    kStartDragMinVersion = 0,
    kRegisterDropTargetMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct StartDrag_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct RegisterDropTarget_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~TabDragService() = default;

  using StartDragCallback = base::OnceCallback<void(base::expected<
  ::std::monostate,
  ::mojo_base::mojom::ErrorPtr>)>;
  using StartDragResult = base::expected<
  ::std::monostate,
  ::mojo_base::mojom::ErrorPtr>;
  using StartDragMojoCallback = base::OnceCallback<void(TabDragService_StartDrag_ResponseParam_ResultPtr)>;

  virtual void StartDrag(const std::vector<::tabs_api::NodeId>& node_ids, const ::gfx::Point& start_point, int32_t tab_original_offset_x, float mouse_to_tab_x_ratio, StartDragCallback callback) = 0;

  using RegisterDropTargetCallback = base::OnceCallback<void(base::expected<
  ::std::monostate,
  ::mojo_base::mojom::ErrorPtr>)>;
  using RegisterDropTargetResult = base::expected<
  ::std::monostate,
  ::mojo_base::mojom::ErrorPtr>;
  using RegisterDropTargetMojoCallback = base::OnceCallback<void(TabDragService_RegisterDropTarget_ResponseParam_ResultPtr)>;

  virtual void RegisterDropTarget(::mojo::PendingAssociatedRemote<DropTarget> target, ::mojo::PendingAssociatedReceiver<DropTargetRegistration> registration, RegisterDropTargetCallback callback) = 0;
};




class TabDragServiceDirectReturnStub {
 public:
   virtual ~TabDragServiceDirectReturnStub() = default;


   using StartDragResult = TabDragService::StartDragResult;
   virtual TabDragService::StartDragResult StartDrag(const std::vector<::tabs_api::NodeId>& node_ids, const ::gfx::Point& start_point, int32_t tab_original_offset_x, float mouse_to_tab_x_ratio) = 0;

   using RegisterDropTargetResult = TabDragService::RegisterDropTargetResult;
   virtual TabDragService::RegisterDropTargetResult RegisterDropTarget(::mojo::PendingAssociatedRemote<DropTarget> target, ::mojo::PendingAssociatedReceiver<DropTargetRegistration> registration) = 0;

};

class TabDragServiceBridge : public TabDragService {
 public:
   // The bridge owns the direct return stub. Use the bridge to manage the
   // lifetime of the service, as if it was a normal mojo service impl.
   TabDragServiceBridge(TabDragServiceDirectReturnStub* stub);
   TabDragServiceBridge(const TabDragServiceBridge&) = delete;
   TabDragServiceBridge operator=(const TabDragServiceBridge&) = delete;
   ~TabDragServiceBridge() override;


   void StartDrag(const std::vector<::tabs_api::NodeId>& node_ids, const ::gfx::Point& start_point, int32_t tab_original_offset_x, float mouse_to_tab_x_ratio, StartDragCallback callback) override;
   void RegisterDropTarget(::mojo::PendingAssociatedRemote<DropTarget> target, ::mojo::PendingAssociatedReceiver<DropTargetRegistration> registration, RegisterDropTargetCallback callback) override;

 private:
   TabDragServiceDirectReturnStub* stub_;
};

class DropTargetRegistrationProxy;

template <typename ImplRefTraits>
class DropTargetRegistrationStub;

class DropTargetRegistrationRequestValidator;


class DropTargetRegistration
    : public DropTargetRegistrationInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "tabs_api.mojom.DropTargetRegistration";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = DropTargetRegistrationInterfaceBase;
  using Proxy_ = DropTargetRegistrationProxy;

  template <typename ImplRefTraits>
  using Stub_ = DropTargetRegistrationStub<ImplRefTraits>;

  using RequestValidator_ = DropTargetRegistrationRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kOnBoundsChangedMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct OnBoundsChanged_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~DropTargetRegistration() = default;

  virtual void OnBoundsChanged(const ::gfx::Rect& bounds) = 0;
};

class DropTargetProxy;

template <typename ImplRefTraits>
class DropTargetStub;

class DropTargetRequestValidator;


class DropTarget
    : public DropTargetInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "tabs_api.mojom.DropTarget";
  static IPCStableHashFunction MessageToMethodInfo_(mojo::Message& message);
  static const char* MessageToMethodName_(mojo::Message& message);
  static constexpr uint32_t Version_ = 0;
  static constexpr bool PassesAssociatedKinds_ = false;
  static constexpr bool HasUninterruptableMethods_ = false;

  using Base_ = DropTargetInterfaceBase;
  using Proxy_ = DropTargetProxy;

  template <typename ImplRefTraits>
  using Stub_ = DropTargetStub<ImplRefTraits>;

  using RequestValidator_ = DropTargetRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kOnDragEnteredMinVersion = 0,
    kOnDragMinVersion = 0,
    kOnDragLeaveMinVersion = 0,
    kOnDropMinVersion = 0,
    kOnDragCancelledMinVersion = 0,
  };

// crbug.com/1340245 - this causes binary size bloat on Fuchsia, and we're OK
// with not having this data in traces there.
#if !BUILDFLAG(IS_FUCHSIA)
  struct OnDragEntered_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnDrag_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnDragLeave_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnDrop_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnDragCancelled_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~DropTarget() = default;

  virtual void OnDragEntered(const std::vector<::tabs_api::NodeId>& source_tab_ids, const ::gfx::Point& local_point, float mouse_to_tab_x_ratio) = 0;

  virtual void OnDrag(const ::gfx::Point& local_point) = 0;

  virtual void OnDragLeave() = 0;

  virtual void OnDrop(const std::vector<::tabs_api::NodeId>& source_tab_ids, const ::gfx::Point& local_point) = 0;

  virtual void OnDragCancelled() = 0;
};



class  TabDragServiceProxy
    : public TabDragService {
 public:
  using InterfaceType = TabDragService;

  explicit TabDragServiceProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void StartDrag(const std::vector<::tabs_api::NodeId>& node_ids, const ::gfx::Point& start_point, int32_t tab_original_offset_x, float mouse_to_tab_x_ratio, StartDragCallback callback) final;
  
  void RegisterDropTarget(::mojo::PendingAssociatedRemote<DropTarget> target, ::mojo::PendingAssociatedReceiver<DropTargetRegistration> registration, RegisterDropTargetCallback callback) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class  DropTargetRegistrationProxy
    : public DropTargetRegistration {
 public:
  using InterfaceType = DropTargetRegistration;

  explicit DropTargetRegistrationProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void OnBoundsChanged(const ::gfx::Rect& bounds) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class  DropTargetProxy
    : public DropTarget {
 public:
  using InterfaceType = DropTarget;

  explicit DropTargetProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void OnDragEntered(const std::vector<::tabs_api::NodeId>& source_tab_ids, const ::gfx::Point& local_point, float mouse_to_tab_x_ratio) final;
  
  void OnDrag(const ::gfx::Point& local_point) final;
  
  void OnDragLeave() final;
  
  void OnDrop(const std::vector<::tabs_api::NodeId>& source_tab_ids, const ::gfx::Point& local_point) final;
  
  void OnDragCancelled() final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};
class  TabDragServiceStubDispatch {
 public:
  static bool Accept(TabDragService* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      TabDragService* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<TabDragService>>
class TabDragServiceStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  TabDragServiceStub() = default;
  ~TabDragServiceStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return TabDragServiceStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return TabDragServiceStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class  DropTargetRegistrationStubDispatch {
 public:
  static bool Accept(DropTargetRegistration* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      DropTargetRegistration* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<DropTargetRegistration>>
class DropTargetRegistrationStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  DropTargetRegistrationStub() = default;
  ~DropTargetRegistrationStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DropTargetRegistrationStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DropTargetRegistrationStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class  DropTargetStubDispatch {
 public:
  static bool Accept(DropTarget* impl, mojo::Message* message);
  static bool AcceptWithResponder(
      DropTarget* impl,
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder);
};

template <typename ImplRefTraits =
              mojo::RawPtrImplRefTraits<DropTarget>>
class DropTargetStub
    : public mojo::MessageReceiverWithResponderStatus {
 public:
  using ImplPointerType = typename ImplRefTraits::PointerType;

  DropTargetStub() = default;
  ~DropTargetStub() override = default;

  void set_sink(ImplPointerType sink) { sink_ = std::move(sink); }
  ImplPointerType& sink() { return sink_; }

  bool Accept(mojo::Message* message) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DropTargetStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

  bool AcceptWithResponder(
      mojo::Message* message,
      std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override {
    if (ImplRefTraits::IsNull(sink_))
      return false;
    return DropTargetStubDispatch::AcceptWithResponder(
        ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder));
  }

 private:
  ImplPointerType sink_;
};
class  TabDragServiceRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class  DropTargetRegistrationRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class  DropTargetRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class  TabDragServiceResponseValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};





class  TabDragService_StartDrag_ResponseParam_Result {
 public:
  using DataView = TabDragService_StartDrag_ResponseParam_ResultDataView;
  using Data_ = internal::TabDragService_StartDrag_ResponseParam_Result_Data;
  using Tag = Data_::TabDragService_StartDrag_ResponseParam_Result_Tag;

  template <typename... Args>
  static TabDragService_StartDrag_ResponseParam_ResultPtr New(Args&&... args) {
    static_assert(
        sizeof...(args) < 0,
        "Do not use Union::New(); to create a union of a given subtype, use "
        "New<SubType>(), not New() followed by set_<sub_type>(). To represent "
        "an empty union, mark the field or parameter as nullable in the mojom "
        "definition.");
    return nullptr;
  }

  // Construct an instance holding |success|.
  static TabDragService_StartDrag_ResponseParam_ResultPtr NewSuccess(
      const ::std::monostate& value);
  // Construct an instance holding |failure|.
  static TabDragService_StartDrag_ResponseParam_ResultPtr NewFailure(
      ::mojo_base::mojom::ErrorPtr value);

  template <typename U>
  static TabDragService_StartDrag_ResponseParam_ResultPtr From(const U& u) {
    return mojo::TypeConverter<TabDragService_StartDrag_ResponseParam_ResultPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, TabDragService_StartDrag_ResponseParam_Result>::Convert(*this);
  }
  ~TabDragService_StartDrag_ResponseParam_Result();

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  TabDragService_StartDrag_ResponseParam_Result(const TabDragService_StartDrag_ResponseParam_Result& other) = delete;
  TabDragService_StartDrag_ResponseParam_Result& operator=(const TabDragService_StartDrag_ResponseParam_Result& other) = delete;

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename UnionPtrType = TabDragService_StartDrag_ResponseParam_ResultPtr>
  TabDragService_StartDrag_ResponseParam_ResultPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T,
            typename std::enable_if<std::is_same<
                T, TabDragService_StartDrag_ResponseParam_Result>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, TabDragService_StartDrag_ResponseParam_Result>::value>::type* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  Tag which() const {
    return tag_;
  }

  bool is_success() const { return tag_ == Tag::kSuccess; }
  const ::std::monostate& get_success() const {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  ::std::monostate& get_success() {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  void set_success(const ::std::monostate& success);

  bool is_failure() const { return tag_ == Tag::kFailure; }
  const ::mojo_base::mojom::ErrorPtr& get_failure() const {
    CHECK(tag_ == Tag::kFailure);
    return data_.failure;
  }
  ::mojo_base::mojom::ErrorPtr& get_failure() {
    CHECK(tag_ == Tag::kFailure);
    return data_.failure;
  }
  void set_failure(::mojo_base::mojom::ErrorPtr failure);

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        TabDragService_StartDrag_ResponseParam_Result::DataView>(input);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<TabDragService_StartDrag_ResponseParam_Result::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

 private:
  template <typename T>
  friend class ::mojo::InlinedStructPtr;
  template <typename T>
  friend class ::mojo::StructPtr;

  union Union_ {
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
        const ::std::monostate& value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
        ::mojo_base::mojom::ErrorPtr value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    ::std::monostate success;
    ::mojo_base::mojom::ErrorPtr failure;
  };

  TabDragService_StartDrag_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
      const ::std::monostate& value);
  TabDragService_StartDrag_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
      ::mojo_base::mojom::ErrorPtr value);

  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);

  void DestroyActive();
  Tag tag_;
  Union_ data_;
};



class  TabDragService_RegisterDropTarget_ResponseParam_Result {
 public:
  using DataView = TabDragService_RegisterDropTarget_ResponseParam_ResultDataView;
  using Data_ = internal::TabDragService_RegisterDropTarget_ResponseParam_Result_Data;
  using Tag = Data_::TabDragService_RegisterDropTarget_ResponseParam_Result_Tag;

  template <typename... Args>
  static TabDragService_RegisterDropTarget_ResponseParam_ResultPtr New(Args&&... args) {
    static_assert(
        sizeof...(args) < 0,
        "Do not use Union::New(); to create a union of a given subtype, use "
        "New<SubType>(), not New() followed by set_<sub_type>(). To represent "
        "an empty union, mark the field or parameter as nullable in the mojom "
        "definition.");
    return nullptr;
  }

  // Construct an instance holding |success|.
  static TabDragService_RegisterDropTarget_ResponseParam_ResultPtr NewSuccess(
      const ::std::monostate& value);
  // Construct an instance holding |failure|.
  static TabDragService_RegisterDropTarget_ResponseParam_ResultPtr NewFailure(
      ::mojo_base::mojom::ErrorPtr value);

  template <typename U>
  static TabDragService_RegisterDropTarget_ResponseParam_ResultPtr From(const U& u) {
    return mojo::TypeConverter<TabDragService_RegisterDropTarget_ResponseParam_ResultPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, TabDragService_RegisterDropTarget_ResponseParam_Result>::Convert(*this);
  }
  ~TabDragService_RegisterDropTarget_ResponseParam_Result();

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  TabDragService_RegisterDropTarget_ResponseParam_Result(const TabDragService_RegisterDropTarget_ResponseParam_Result& other) = delete;
  TabDragService_RegisterDropTarget_ResponseParam_Result& operator=(const TabDragService_RegisterDropTarget_ResponseParam_Result& other) = delete;

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename UnionPtrType = TabDragService_RegisterDropTarget_ResponseParam_ResultPtr>
  TabDragService_RegisterDropTarget_ResponseParam_ResultPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T,
            typename std::enable_if<std::is_same<
                T, TabDragService_RegisterDropTarget_ResponseParam_Result>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, TabDragService_RegisterDropTarget_ResponseParam_Result>::value>::type* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  Tag which() const {
    return tag_;
  }

  bool is_success() const { return tag_ == Tag::kSuccess; }
  const ::std::monostate& get_success() const {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  ::std::monostate& get_success() {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  void set_success(const ::std::monostate& success);

  bool is_failure() const { return tag_ == Tag::kFailure; }
  const ::mojo_base::mojom::ErrorPtr& get_failure() const {
    CHECK(tag_ == Tag::kFailure);
    return data_.failure;
  }
  ::mojo_base::mojom::ErrorPtr& get_failure() {
    CHECK(tag_ == Tag::kFailure);
    return data_.failure;
  }
  void set_failure(::mojo_base::mojom::ErrorPtr failure);

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        TabDragService_RegisterDropTarget_ResponseParam_Result::DataView>(input);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<TabDragService_RegisterDropTarget_ResponseParam_Result::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

 private:
  template <typename T>
  friend class ::mojo::InlinedStructPtr;
  template <typename T>
  friend class ::mojo::StructPtr;

  union Union_ {
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
        const ::std::monostate& value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
        ::mojo_base::mojom::ErrorPtr value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    ::std::monostate success;
    ::mojo_base::mojom::ErrorPtr failure;
  };

  TabDragService_RegisterDropTarget_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
      const ::std::monostate& value);
  TabDragService_RegisterDropTarget_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
      ::mojo_base::mojom::ErrorPtr value);

  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);

  void DestroyActive();
  Tag tag_;
  Union_ data_;
};

template <typename UnionPtrType>
TabDragService_StartDrag_ResponseParam_ResultPtr TabDragService_StartDrag_ResponseParam_Result::Clone() const {
  switch (tag_) {
    case Tag::kSuccess:
      return NewSuccess(
          mojo::Clone(data_.success));
    case Tag::kFailure:
      return NewFailure(
          mojo::Clone(data_.failure));
  }
  return nullptr;
}

template <typename T,
          typename std::enable_if<std::is_same<
              T, TabDragService_StartDrag_ResponseParam_Result>::value>::type*>
bool TabDragService_StartDrag_ResponseParam_Result::Equals(const T& other) const {
  if (tag_ != other.which())
    return false;

  switch (tag_) {
    case Tag::kSuccess:
      return mojo::Equals(data_.success, other.data_.success);
    case Tag::kFailure:
      return mojo::Equals(data_.failure, other.data_.failure);
  }

  return false;
}
template <typename UnionPtrType>
TabDragService_RegisterDropTarget_ResponseParam_ResultPtr TabDragService_RegisterDropTarget_ResponseParam_Result::Clone() const {
  switch (tag_) {
    case Tag::kSuccess:
      return NewSuccess(
          mojo::Clone(data_.success));
    case Tag::kFailure:
      return NewFailure(
          mojo::Clone(data_.failure));
  }
  return nullptr;
}

template <typename T,
          typename std::enable_if<std::is_same<
              T, TabDragService_RegisterDropTarget_ResponseParam_Result>::value>::type*>
bool TabDragService_RegisterDropTarget_ResponseParam_Result::Equals(const T& other) const {
  if (tag_ != other.which())
    return false;

  switch (tag_) {
    case Tag::kSuccess:
      return mojo::Equals(data_.success, other.data_.success);
    case Tag::kFailure:
      return mojo::Equals(data_.failure, other.data_.failure);
  }

  return false;
}


}  // tabs_api::mojom

namespace mojo {


template <>
struct  UnionTraits<::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_Result::DataView,
                                        ::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_ResultPtr> {
  static bool IsNull(const ::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_ResultPtr& input) { return !input; }
  static void SetToNull(::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_ResultPtr* output) { output->reset(); }

  static ::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_Result::Tag GetTag(const ::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_ResultPtr& input) {
    return input->which();
  }

  static const ::std::monostate& success(const ::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_ResultPtr& input) {
    return input->get_success();
  }

  static const ::mojo_base::mojom::ErrorPtr& failure(const ::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_ResultPtr& input) {
    return input->get_failure();
  }

  static bool Read(::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_Result::DataView input, ::tabs_api::mojom::TabDragService_StartDrag_ResponseParam_ResultPtr* output);
};


template <>
struct  UnionTraits<::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_Result::DataView,
                                        ::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_ResultPtr> {
  static bool IsNull(const ::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_ResultPtr& input) { return !input; }
  static void SetToNull(::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_ResultPtr* output) { output->reset(); }

  static ::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_Result::Tag GetTag(const ::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_ResultPtr& input) {
    return input->which();
  }

  static const ::std::monostate& success(const ::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_ResultPtr& input) {
    return input->get_success();
  }

  static const ::mojo_base::mojom::ErrorPtr& failure(const ::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_ResultPtr& input) {
    return input->get_failure();
  }

  static bool Read(::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_Result::DataView input, ::tabs_api::mojom::TabDragService_RegisterDropTarget_ResponseParam_ResultPtr* output);
};

}  // namespace mojo

#endif  // COMPONENTS_BROWSER_APIS_TAB_DRAG_TAB_DRAG_API_MOJOM_H_