// third_party/blink/public/mojom/device/device.mojom-blink.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 THIRD_PARTY_BLINK_PUBLIC_MOJOM_DEVICE_DEVICE_MOJOM_BLINK_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_DEVICE_DEVICE_MOJOM_BLINK_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 "mojo/public/cpp/bindings/lib/serialization.h"

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

#include "third_party/blink/public/mojom/device/device.mojom-features.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/device/device.mojom-shared.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/device/device.mojom-blink-forward.h"  // IWYU pragma: export

#include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h"
#include "mojo/public/cpp/bindings/lib/wtf_hash_util.h"
#include "third_party/blink/renderer/platform/wtf/hash_functions.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

#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"
#include "third_party/blink/renderer/platform/platform_export.h"
#if !BLINK_MOJO_IMPL && !INSIDE_BLINK
#error "File must only be imported inside blink"
#endif




namespace blink::mojom::blink {

class ManagedConfigurationObserverProxy;

template <typename ImplRefTraits>
class ManagedConfigurationObserverStub;

class ManagedConfigurationObserverRequestValidator;


class PLATFORM_EXPORT ManagedConfigurationObserver
    : public ManagedConfigurationObserverInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.ManagedConfigurationObserver";
  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_ = ManagedConfigurationObserverInterfaceBase;
  using Proxy_ = ManagedConfigurationObserverProxy;

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

  using RequestValidator_ = ManagedConfigurationObserverRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kOnConfigurationChangedMinVersion = 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 OnConfigurationChanged_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~ManagedConfigurationObserver() = default;

  virtual void OnConfigurationChanged() = 0;
};

class DeviceAPIServiceProxy;

template <typename ImplRefTraits>
class DeviceAPIServiceStub;

class DeviceAPIServiceRequestValidator;
class DeviceAPIServiceResponseValidator;


class PLATFORM_EXPORT DeviceAPIService
    : public DeviceAPIServiceInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.DeviceAPIService";
  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_ = DeviceAPIServiceInterfaceBase;
  using Proxy_ = DeviceAPIServiceProxy;

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

  using RequestValidator_ = DeviceAPIServiceRequestValidator;
  using ResponseValidator_ = DeviceAPIServiceResponseValidator;
  enum MethodMinVersions : uint32_t {
    kGetDirectoryIdMinVersion = 0,
    kGetHostnameMinVersion = 0,
    kGetSerialNumberMinVersion = 0,
    kGetAnnotatedAssetIdMinVersion = 0,
    kGetAnnotatedLocationMinVersion = 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 GetDirectoryId_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct GetHostname_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct GetSerialNumber_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct GetAnnotatedAssetId_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct GetAnnotatedLocation_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~DeviceAPIService() = default;

  using GetDirectoryIdCallback = base::OnceCallback<void(base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>)>;
  using GetDirectoryIdResult = base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>;
  using GetDirectoryIdMojoCallback = base::OnceCallback<void(DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr)>;

  virtual void GetDirectoryId(GetDirectoryIdCallback callback) = 0;

  using GetHostnameCallback = base::OnceCallback<void(base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>)>;
  using GetHostnameResult = base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>;
  using GetHostnameMojoCallback = base::OnceCallback<void(DeviceAPIService_GetHostname_ResponseParam_ResultPtr)>;

  virtual void GetHostname(GetHostnameCallback callback) = 0;

  using GetSerialNumberCallback = base::OnceCallback<void(base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>)>;
  using GetSerialNumberResult = base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>;
  using GetSerialNumberMojoCallback = base::OnceCallback<void(DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr)>;

  virtual void GetSerialNumber(GetSerialNumberCallback callback) = 0;

  using GetAnnotatedAssetIdCallback = base::OnceCallback<void(base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>)>;
  using GetAnnotatedAssetIdResult = base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>;
  using GetAnnotatedAssetIdMojoCallback = base::OnceCallback<void(DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr)>;

  virtual void GetAnnotatedAssetId(GetAnnotatedAssetIdCallback callback) = 0;

  using GetAnnotatedLocationCallback = base::OnceCallback<void(base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>)>;
  using GetAnnotatedLocationResult = base::expected<
  DeviceAttributeValuePtr,
  ::blink::String>;
  using GetAnnotatedLocationMojoCallback = base::OnceCallback<void(DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr)>;

  virtual void GetAnnotatedLocation(GetAnnotatedLocationCallback callback) = 0;
};

class ManagedConfigurationServiceProxy;

template <typename ImplRefTraits>
class ManagedConfigurationServiceStub;

class ManagedConfigurationServiceRequestValidator;
class ManagedConfigurationServiceResponseValidator;


class PLATFORM_EXPORT ManagedConfigurationService
    : public ManagedConfigurationServiceInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "blink.mojom.ManagedConfigurationService";
  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_ = ManagedConfigurationServiceInterfaceBase;
  using Proxy_ = ManagedConfigurationServiceProxy;

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

  using RequestValidator_ = ManagedConfigurationServiceRequestValidator;
  using ResponseValidator_ = ManagedConfigurationServiceResponseValidator;
  enum MethodMinVersions : uint32_t {
    kGetManagedConfigurationMinVersion = 0,
    kSubscribeToManagedConfigurationMinVersion = 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 GetManagedConfiguration_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct SubscribeToManagedConfiguration_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~ManagedConfigurationService() = default;

  using GetManagedConfigurationCallback = base::OnceCallback<void(const std::optional<::blink::HashMap<::blink::String, ::blink::String>>&)>;
  using GetManagedConfigurationMojoCallback = base::OnceCallback<void(const std::optional<::blink::HashMap<::blink::String, ::blink::String>>&)>;

  virtual void GetManagedConfiguration(const ::blink::Vector<::blink::String>& keys, GetManagedConfigurationCallback callback) = 0;

  virtual void SubscribeToManagedConfiguration(::mojo::PendingRemote<ManagedConfigurationObserver> observer) = 0;
};



class PLATFORM_EXPORT ManagedConfigurationObserverProxy
    : public ManagedConfigurationObserver {
 public:
  using InterfaceType = ManagedConfigurationObserver;

  explicit ManagedConfigurationObserverProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void OnConfigurationChanged() final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class PLATFORM_EXPORT DeviceAPIServiceProxy
    : public DeviceAPIService {
 public:
  using InterfaceType = DeviceAPIService;

  explicit DeviceAPIServiceProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void GetDirectoryId(GetDirectoryIdCallback callback) final;
  
  void GetHostname(GetHostnameCallback callback) final;
  
  void GetSerialNumber(GetSerialNumberCallback callback) final;
  
  void GetAnnotatedAssetId(GetAnnotatedAssetIdCallback callback) final;
  
  void GetAnnotatedLocation(GetAnnotatedLocationCallback callback) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class PLATFORM_EXPORT ManagedConfigurationServiceProxy
    : public ManagedConfigurationService {
 public:
  using InterfaceType = ManagedConfigurationService;

  explicit ManagedConfigurationServiceProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void GetManagedConfiguration(const ::blink::Vector<::blink::String>& keys, GetManagedConfigurationCallback callback) final;
  
  void SubscribeToManagedConfiguration(::mojo::PendingRemote<ManagedConfigurationObserver> observer) final;

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

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

  ManagedConfigurationObserverStub() = default;
  ~ManagedConfigurationObserverStub() 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 ManagedConfigurationObserverStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

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

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

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

  DeviceAPIServiceStub() = default;
  ~DeviceAPIServiceStub() 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 DeviceAPIServiceStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

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

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

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

  ManagedConfigurationServiceStub() = default;
  ~ManagedConfigurationServiceStub() 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 ManagedConfigurationServiceStubDispatch::Accept(
        ImplRefTraits::GetRawPointer(&sink_), message);
  }

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

 private:
  ImplPointerType sink_;
};
class PLATFORM_EXPORT ManagedConfigurationObserverRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT DeviceAPIServiceRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT ManagedConfigurationServiceRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT DeviceAPIServiceResponseValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class PLATFORM_EXPORT ManagedConfigurationServiceResponseValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};





class PLATFORM_EXPORT DeviceAttributeValue {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<DeviceAttributeValue, T>::value>;
  using DataView = DeviceAttributeValueDataView;
  using Data_ = internal::DeviceAttributeValue_Data;

  template <typename... Args>
  static DeviceAttributeValuePtr New(Args&&... args) {
    return DeviceAttributeValuePtr(
        std::in_place, std::forward<Args>(args)...);
  }

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

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


  DeviceAttributeValue();

  explicit DeviceAttributeValue(
      const ::blink::String& value);


  ~DeviceAttributeValue();

  // 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 StructPtrType = DeviceAttributeValuePtr>
  DeviceAttributeValuePtr 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, DeviceAttributeValue::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, DeviceAttributeValue::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, DeviceAttributeValue::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        DeviceAttributeValue::DataView, ::blink::Vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static ::blink::Vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        DeviceAttributeValue::DataView, ::blink::Vector<uint8_t>>(input);
  }

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

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::DeviceAttributeValue_UnserializedMessageContext<
            UserType, DeviceAttributeValue::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<DeviceAttributeValue::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return DeviceAttributeValue::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::DeviceAttributeValue_UnserializedMessageContext<
            UserType, DeviceAttributeValue::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<DeviceAttributeValue::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  ::blink::String value;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

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

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, DeviceAttributeValue::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, DeviceAttributeValue::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, DeviceAttributeValue::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, DeviceAttributeValue::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}





class PLATFORM_EXPORT DeviceAPIService_GetDirectoryId_ResponseParam_Result {
 public:
  using DataView = DeviceAPIService_GetDirectoryId_ResponseParam_ResultDataView;
  using Data_ = internal::DeviceAPIService_GetDirectoryId_ResponseParam_Result_Data;
  using Tag = Data_::DeviceAPIService_GetDirectoryId_ResponseParam_Result_Tag;

  template <typename... Args>
  static DeviceAPIService_GetDirectoryId_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 DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr NewSuccess(
      DeviceAttributeValuePtr value);
  // Construct an instance holding |failure|.
  static DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr NewFailure(
      const ::blink::String& value);

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

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

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  DeviceAPIService_GetDirectoryId_ResponseParam_Result(const DeviceAPIService_GetDirectoryId_ResponseParam_Result& other) = delete;
  DeviceAPIService_GetDirectoryId_ResponseParam_Result& operator=(const DeviceAPIService_GetDirectoryId_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 = DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr>
  DeviceAPIService_GetDirectoryId_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, DeviceAPIService_GetDirectoryId_ResponseParam_Result>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, DeviceAPIService_GetDirectoryId_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 DeviceAttributeValuePtr& get_success() const {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  DeviceAttributeValuePtr& get_success() {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  void set_success(DeviceAttributeValuePtr success);

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

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

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<DeviceAPIService_GetDirectoryId_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)>,
        DeviceAttributeValuePtr value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
        const ::blink::String& value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    DeviceAttributeValuePtr success;
    ::blink::String failure;
  };

  DeviceAPIService_GetDirectoryId_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
      DeviceAttributeValuePtr value);
  DeviceAPIService_GetDirectoryId_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
      const ::blink::String& value);

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

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



class PLATFORM_EXPORT DeviceAPIService_GetHostname_ResponseParam_Result {
 public:
  using DataView = DeviceAPIService_GetHostname_ResponseParam_ResultDataView;
  using Data_ = internal::DeviceAPIService_GetHostname_ResponseParam_Result_Data;
  using Tag = Data_::DeviceAPIService_GetHostname_ResponseParam_Result_Tag;

  template <typename... Args>
  static DeviceAPIService_GetHostname_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 DeviceAPIService_GetHostname_ResponseParam_ResultPtr NewSuccess(
      DeviceAttributeValuePtr value);
  // Construct an instance holding |failure|.
  static DeviceAPIService_GetHostname_ResponseParam_ResultPtr NewFailure(
      const ::blink::String& value);

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

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

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  DeviceAPIService_GetHostname_ResponseParam_Result(const DeviceAPIService_GetHostname_ResponseParam_Result& other) = delete;
  DeviceAPIService_GetHostname_ResponseParam_Result& operator=(const DeviceAPIService_GetHostname_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 = DeviceAPIService_GetHostname_ResponseParam_ResultPtr>
  DeviceAPIService_GetHostname_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, DeviceAPIService_GetHostname_ResponseParam_Result>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, DeviceAPIService_GetHostname_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 DeviceAttributeValuePtr& get_success() const {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  DeviceAttributeValuePtr& get_success() {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  void set_success(DeviceAttributeValuePtr success);

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

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

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<DeviceAPIService_GetHostname_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)>,
        DeviceAttributeValuePtr value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
        const ::blink::String& value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    DeviceAttributeValuePtr success;
    ::blink::String failure;
  };

  DeviceAPIService_GetHostname_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
      DeviceAttributeValuePtr value);
  DeviceAPIService_GetHostname_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
      const ::blink::String& value);

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

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



class PLATFORM_EXPORT DeviceAPIService_GetSerialNumber_ResponseParam_Result {
 public:
  using DataView = DeviceAPIService_GetSerialNumber_ResponseParam_ResultDataView;
  using Data_ = internal::DeviceAPIService_GetSerialNumber_ResponseParam_Result_Data;
  using Tag = Data_::DeviceAPIService_GetSerialNumber_ResponseParam_Result_Tag;

  template <typename... Args>
  static DeviceAPIService_GetSerialNumber_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 DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr NewSuccess(
      DeviceAttributeValuePtr value);
  // Construct an instance holding |failure|.
  static DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr NewFailure(
      const ::blink::String& value);

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

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

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  DeviceAPIService_GetSerialNumber_ResponseParam_Result(const DeviceAPIService_GetSerialNumber_ResponseParam_Result& other) = delete;
  DeviceAPIService_GetSerialNumber_ResponseParam_Result& operator=(const DeviceAPIService_GetSerialNumber_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 = DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr>
  DeviceAPIService_GetSerialNumber_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, DeviceAPIService_GetSerialNumber_ResponseParam_Result>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, DeviceAPIService_GetSerialNumber_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 DeviceAttributeValuePtr& get_success() const {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  DeviceAttributeValuePtr& get_success() {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  void set_success(DeviceAttributeValuePtr success);

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

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

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<DeviceAPIService_GetSerialNumber_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)>,
        DeviceAttributeValuePtr value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
        const ::blink::String& value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    DeviceAttributeValuePtr success;
    ::blink::String failure;
  };

  DeviceAPIService_GetSerialNumber_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
      DeviceAttributeValuePtr value);
  DeviceAPIService_GetSerialNumber_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
      const ::blink::String& value);

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

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



class PLATFORM_EXPORT DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result {
 public:
  using DataView = DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultDataView;
  using Data_ = internal::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result_Data;
  using Tag = Data_::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result_Tag;

  template <typename... Args>
  static DeviceAPIService_GetAnnotatedAssetId_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 DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr NewSuccess(
      DeviceAttributeValuePtr value);
  // Construct an instance holding |failure|.
  static DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr NewFailure(
      const ::blink::String& value);

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

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

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result(const DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result& other) = delete;
  DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result& operator=(const DeviceAPIService_GetAnnotatedAssetId_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 = DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr>
  DeviceAPIService_GetAnnotatedAssetId_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, DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, DeviceAPIService_GetAnnotatedAssetId_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 DeviceAttributeValuePtr& get_success() const {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  DeviceAttributeValuePtr& get_success() {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  void set_success(DeviceAttributeValuePtr success);

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

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

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<DeviceAPIService_GetAnnotatedAssetId_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)>,
        DeviceAttributeValuePtr value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
        const ::blink::String& value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    DeviceAttributeValuePtr success;
    ::blink::String failure;
  };

  DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
      DeviceAttributeValuePtr value);
  DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
      const ::blink::String& value);

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

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



class PLATFORM_EXPORT DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result {
 public:
  using DataView = DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultDataView;
  using Data_ = internal::DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result_Data;
  using Tag = Data_::DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result_Tag;

  template <typename... Args>
  static DeviceAPIService_GetAnnotatedLocation_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 DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr NewSuccess(
      DeviceAttributeValuePtr value);
  // Construct an instance holding |failure|.
  static DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr NewFailure(
      const ::blink::String& value);

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

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

  // Delete the copy constructor and copy assignment operators because `data_`
  // contains raw pointers that must not be copied.
  DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result(const DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result& other) = delete;
  DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result& operator=(const DeviceAPIService_GetAnnotatedLocation_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 = DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr>
  DeviceAPIService_GetAnnotatedLocation_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, DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result>::value>::type* = nullptr>
  bool Equals(const T& other) const;

  template <typename T,
            typename std::enable_if<std::is_same<
                T, DeviceAPIService_GetAnnotatedLocation_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 DeviceAttributeValuePtr& get_success() const {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  DeviceAttributeValuePtr& get_success() {
    CHECK(tag_ == Tag::kSuccess);
    return data_.success;
  }
  void set_success(DeviceAttributeValuePtr success);

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

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

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    return mojo::internal::DeserializeImpl<DeviceAPIService_GetAnnotatedLocation_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)>,
        DeviceAttributeValuePtr value);
    Union_(
        std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
        const ::blink::String& value);
    // The contents of the union are explicitly destroyed by `DestroyActive()`.
    ~Union_() {}

    DeviceAttributeValuePtr success;
    ::blink::String failure;
  };

  DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kSuccess)>,
      DeviceAttributeValuePtr value);
  DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result(
      std::in_place_index_t<static_cast<size_t>(Tag::kFailure)>,
      const ::blink::String& value);

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

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


template <typename UnionPtrType>
DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr DeviceAPIService_GetDirectoryId_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, DeviceAPIService_GetDirectoryId_ResponseParam_Result>::value>::type*>
bool DeviceAPIService_GetDirectoryId_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>
DeviceAPIService_GetHostname_ResponseParam_ResultPtr DeviceAPIService_GetHostname_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, DeviceAPIService_GetHostname_ResponseParam_Result>::value>::type*>
bool DeviceAPIService_GetHostname_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>
DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr DeviceAPIService_GetSerialNumber_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, DeviceAPIService_GetSerialNumber_ResponseParam_Result>::value>::type*>
bool DeviceAPIService_GetSerialNumber_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>
DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr DeviceAPIService_GetAnnotatedAssetId_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, DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result>::value>::type*>
bool DeviceAPIService_GetAnnotatedAssetId_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>
DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr DeviceAPIService_GetAnnotatedLocation_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, DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result>::value>::type*>
bool DeviceAPIService_GetAnnotatedLocation_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 StructPtrType>
DeviceAttributeValuePtr DeviceAttributeValue::Clone() const {
  return New(
      mojo::Clone(value)
  );
}

template <typename T, DeviceAttributeValue::EnableIfSame<T>*>
bool DeviceAttributeValue::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->value, other_struct.value))
    return false;
  return true;
}

template <typename T, DeviceAttributeValue::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.value < rhs.value)
    return true;
  if (rhs.value < lhs.value)
    return false;
  return false;
}


}  // blink::mojom::blink

namespace mojo {


template <>
struct PLATFORM_EXPORT StructTraits<::blink::mojom::blink::DeviceAttributeValue::DataView,
                                         ::blink::mojom::blink::DeviceAttributeValuePtr> {
  static bool IsNull(const ::blink::mojom::blink::DeviceAttributeValuePtr& input) { return !input; }
  static void SetToNull(::blink::mojom::blink::DeviceAttributeValuePtr* output) { output->reset(); }

  static const decltype(::blink::mojom::blink::DeviceAttributeValue::value)& value(
      const ::blink::mojom::blink::DeviceAttributeValuePtr& input) {
    return input->value;
  }

  static bool Read(::blink::mojom::blink::DeviceAttributeValue::DataView input, ::blink::mojom::blink::DeviceAttributeValuePtr* output);
};


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

  static ::blink::mojom::blink::DeviceAPIService_GetDirectoryId_ResponseParam_Result::Tag GetTag(const ::blink::mojom::blink::DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr& input) {
    return input->which();
  }

  static const ::blink::mojom::blink::DeviceAttributeValuePtr& success(const ::blink::mojom::blink::DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr& input) {
    return input->get_success();
  }

  static const ::blink::String& failure(const ::blink::mojom::blink::DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr& input) {
    return input->get_failure();
  }

  static bool Read(::blink::mojom::blink::DeviceAPIService_GetDirectoryId_ResponseParam_Result::DataView input, ::blink::mojom::blink::DeviceAPIService_GetDirectoryId_ResponseParam_ResultPtr* output);
};


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

  static ::blink::mojom::blink::DeviceAPIService_GetHostname_ResponseParam_Result::Tag GetTag(const ::blink::mojom::blink::DeviceAPIService_GetHostname_ResponseParam_ResultPtr& input) {
    return input->which();
  }

  static const ::blink::mojom::blink::DeviceAttributeValuePtr& success(const ::blink::mojom::blink::DeviceAPIService_GetHostname_ResponseParam_ResultPtr& input) {
    return input->get_success();
  }

  static const ::blink::String& failure(const ::blink::mojom::blink::DeviceAPIService_GetHostname_ResponseParam_ResultPtr& input) {
    return input->get_failure();
  }

  static bool Read(::blink::mojom::blink::DeviceAPIService_GetHostname_ResponseParam_Result::DataView input, ::blink::mojom::blink::DeviceAPIService_GetHostname_ResponseParam_ResultPtr* output);
};


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

  static ::blink::mojom::blink::DeviceAPIService_GetSerialNumber_ResponseParam_Result::Tag GetTag(const ::blink::mojom::blink::DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr& input) {
    return input->which();
  }

  static const ::blink::mojom::blink::DeviceAttributeValuePtr& success(const ::blink::mojom::blink::DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr& input) {
    return input->get_success();
  }

  static const ::blink::String& failure(const ::blink::mojom::blink::DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr& input) {
    return input->get_failure();
  }

  static bool Read(::blink::mojom::blink::DeviceAPIService_GetSerialNumber_ResponseParam_Result::DataView input, ::blink::mojom::blink::DeviceAPIService_GetSerialNumber_ResponseParam_ResultPtr* output);
};


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

  static ::blink::mojom::blink::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result::Tag GetTag(const ::blink::mojom::blink::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr& input) {
    return input->which();
  }

  static const ::blink::mojom::blink::DeviceAttributeValuePtr& success(const ::blink::mojom::blink::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr& input) {
    return input->get_success();
  }

  static const ::blink::String& failure(const ::blink::mojom::blink::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr& input) {
    return input->get_failure();
  }

  static bool Read(::blink::mojom::blink::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_Result::DataView input, ::blink::mojom::blink::DeviceAPIService_GetAnnotatedAssetId_ResponseParam_ResultPtr* output);
};


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

  static ::blink::mojom::blink::DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result::Tag GetTag(const ::blink::mojom::blink::DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr& input) {
    return input->which();
  }

  static const ::blink::mojom::blink::DeviceAttributeValuePtr& success(const ::blink::mojom::blink::DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr& input) {
    return input->get_success();
  }

  static const ::blink::String& failure(const ::blink::mojom::blink::DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr& input) {
    return input->get_failure();
  }

  static bool Read(::blink::mojom::blink::DeviceAPIService_GetAnnotatedLocation_ResponseParam_Result::DataView input, ::blink::mojom::blink::DeviceAPIService_GetAnnotatedLocation_ResponseParam_ResultPtr* output);
};

}  // namespace mojo

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_DEVICE_DEVICE_MOJOM_BLINK_H_