// third_party/blink/public/mojom/payments/payment_app_events.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 THIRD_PARTY_BLINK_PUBLIC_MOJOM_PAYMENTS_PAYMENT_APP_EVENTS_MOJOM_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_PAYMENTS_PAYMENT_APP_EVENTS_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 "mojo/public/cpp/bindings/lib/serialization.h"

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

#include "third_party/blink/public/mojom/payments/payment_app_events.mojom-features.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/payments/payment_app_events.mojom-shared.h"  // IWYU pragma: export
#include "third_party/blink/public/mojom/payments/payment_app_events.mojom-forward.h"  // IWYU pragma: export
#include "components/payments/mojom/payment_request_data.mojom.h"
#include "third_party/blink/public/mojom/payments/payment_request.mojom.h"
#include "third_party/blink/public/mojom/payments/payment_handler_host.mojom-forward.h"
#include "url/mojom/url.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 "third_party/blink/public/common/common_export.h"




namespace payments::mojom {

class PaymentHandlerResponseCallbackProxy;

template <typename ImplRefTraits>
class PaymentHandlerResponseCallbackStub;

class PaymentHandlerResponseCallbackRequestValidator;


class BLINK_COMMON_EXPORT PaymentHandlerResponseCallback
    : public PaymentHandlerResponseCallbackInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "payments.mojom.PaymentHandlerResponseCallback";
  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_ = PaymentHandlerResponseCallbackInterfaceBase;
  using Proxy_ = PaymentHandlerResponseCallbackProxy;

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

  using RequestValidator_ = PaymentHandlerResponseCallbackRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kOnResponseForAbortPaymentMinVersion = 0,
    kOnResponseForCanMakePaymentMinVersion = 0,
    kOnResponseForPaymentRequestMinVersion = 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 OnResponseForAbortPayment_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnResponseForCanMakePayment_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnResponseForPaymentRequest_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~PaymentHandlerResponseCallback() = default;

  virtual void OnResponseForAbortPayment(bool payment_aborted) = 0;

  virtual void OnResponseForCanMakePayment(CanMakePaymentResponsePtr response) = 0;

  virtual void OnResponseForPaymentRequest(PaymentHandlerResponsePtr response) = 0;
};



class BLINK_COMMON_EXPORT PaymentHandlerResponseCallbackProxy
    : public PaymentHandlerResponseCallback {
 public:
  using InterfaceType = PaymentHandlerResponseCallback;

  explicit PaymentHandlerResponseCallbackProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void OnResponseForAbortPayment(bool payment_aborted) final;
  
  void OnResponseForCanMakePayment(CanMakePaymentResponsePtr response) final;
  
  void OnResponseForPaymentRequest(PaymentHandlerResponsePtr response) final;

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

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

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

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

 private:
  ImplPointerType sink_;
};
class BLINK_COMMON_EXPORT PaymentHandlerResponseCallbackRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};







class BLINK_COMMON_EXPORT CanMakePaymentResponse {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<CanMakePaymentResponse, T>::value>;
  using DataView = CanMakePaymentResponseDataView;
  using Data_ = internal::CanMakePaymentResponse_Data;

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

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

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


  CanMakePaymentResponse();

  CanMakePaymentResponse(
      CanMakePaymentEventResponseType response_type,
      bool can_make_payment);


  ~CanMakePaymentResponse();

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

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

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

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

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        CanMakePaymentResponse::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        CanMakePaymentResponse::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::CanMakePaymentResponse_UnserializedMessageContext<
            UserType, CanMakePaymentResponse::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<CanMakePaymentResponse::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return CanMakePaymentResponse::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::CanMakePaymentResponse_UnserializedMessageContext<
            UserType, CanMakePaymentResponse::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<CanMakePaymentResponse::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  CanMakePaymentEventResponseType response_type;
  
  bool can_make_payment;

  // 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, CanMakePaymentResponse::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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








class BLINK_COMMON_EXPORT CanMakePaymentEventData {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<CanMakePaymentEventData, T>::value>;
  using DataView = CanMakePaymentEventDataDataView;
  using Data_ = internal::CanMakePaymentEventData_Data;

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

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

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


  CanMakePaymentEventData();

  CanMakePaymentEventData(
      const ::GURL& top_origin,
      const ::GURL& payment_request_origin,
      std::vector<::payments::mojom::PaymentMethodDataPtr> method_data,
      std::vector<::payments::mojom::PaymentDetailsModifierPtr> modifiers);

CanMakePaymentEventData(const CanMakePaymentEventData&) = delete;
CanMakePaymentEventData& operator=(const CanMakePaymentEventData&) = delete;

  ~CanMakePaymentEventData();

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

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

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

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

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        CanMakePaymentEventData::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        CanMakePaymentEventData::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::CanMakePaymentEventData_UnserializedMessageContext<
            UserType, CanMakePaymentEventData::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<CanMakePaymentEventData::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return CanMakePaymentEventData::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::CanMakePaymentEventData_UnserializedMessageContext<
            UserType, CanMakePaymentEventData::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<CanMakePaymentEventData::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  ::GURL top_origin;
  
  ::GURL payment_request_origin;
  
  std::vector<::payments::mojom::PaymentMethodDataPtr> method_data;
  
  std::vector<::payments::mojom::PaymentDetailsModifierPtr> modifiers;

  // 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, CanMakePaymentEventData::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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





class BLINK_COMMON_EXPORT PaymentRequestEventData {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<PaymentRequestEventData, T>::value>;
  using DataView = PaymentRequestEventDataDataView;
  using Data_ = internal::PaymentRequestEventData_Data;

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

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

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


  PaymentRequestEventData();

  PaymentRequestEventData(
      const ::GURL& top_origin,
      const ::GURL& payment_request_origin,
      const std::string& payment_request_id,
      std::vector<::payments::mojom::PaymentMethodDataPtr> method_data,
      ::payments::mojom::PaymentCurrencyAmountPtr total,
      std::vector<::payments::mojom::PaymentDetailsModifierPtr> modifiers,
      const std::string& instrument_key,
      ::payments::mojom::PaymentOptionsPtr payment_options,
      std::optional<std::vector<::payments::mojom::PaymentShippingOptionPtr>> shipping_options,
      ::mojo::PendingRemote<::payments::mojom::PaymentHandlerHost> payment_handler_host);

PaymentRequestEventData(const PaymentRequestEventData&) = delete;
PaymentRequestEventData& operator=(const PaymentRequestEventData&) = delete;

  ~PaymentRequestEventData();

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

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

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

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        PaymentRequestEventData::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::PaymentRequestEventData_UnserializedMessageContext<
            UserType, PaymentRequestEventData::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<PaymentRequestEventData::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return PaymentRequestEventData::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::PaymentRequestEventData_UnserializedMessageContext<
            UserType, PaymentRequestEventData::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<PaymentRequestEventData::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  ::GURL top_origin;
  
  ::GURL payment_request_origin;
  
  std::string payment_request_id;
  
  std::vector<::payments::mojom::PaymentMethodDataPtr> method_data;
  
  ::payments::mojom::PaymentCurrencyAmountPtr total;
  
  std::vector<::payments::mojom::PaymentDetailsModifierPtr> modifiers;
  
  std::string instrument_key;
  
  ::payments::mojom::PaymentOptionsPtr payment_options;
  
  std::optional<std::vector<::payments::mojom::PaymentShippingOptionPtr>> shipping_options;
  
  ::mojo::PendingRemote<::payments::mojom::PaymentHandlerHost> payment_handler_host;

  // 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, PaymentRequestEventData::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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






class BLINK_COMMON_EXPORT PaymentHandlerResponse {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<PaymentHandlerResponse, T>::value>;
  using DataView = PaymentHandlerResponseDataView;
  using Data_ = internal::PaymentHandlerResponse_Data;

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

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

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


  PaymentHandlerResponse();

  PaymentHandlerResponse(
      const std::string& method_name,
      const std::string& stringified_details,
      PaymentEventResponseType response_type,
      const std::optional<std::string>& payer_name,
      const std::optional<std::string>& payer_email,
      const std::optional<std::string>& payer_phone,
      ::payments::mojom::PaymentAddressPtr shipping_address,
      const std::optional<std::string>& shipping_option);

PaymentHandlerResponse(const PaymentHandlerResponse&) = delete;
PaymentHandlerResponse& operator=(const PaymentHandlerResponse&) = delete;

  ~PaymentHandlerResponse();

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

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

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

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

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        PaymentHandlerResponse::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        PaymentHandlerResponse::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::PaymentHandlerResponse_UnserializedMessageContext<
            UserType, PaymentHandlerResponse::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<PaymentHandlerResponse::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return PaymentHandlerResponse::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::PaymentHandlerResponse_UnserializedMessageContext<
            UserType, PaymentHandlerResponse::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<PaymentHandlerResponse::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  std::string method_name;
  
  std::string stringified_details;
  
  PaymentEventResponseType response_type;
  
  std::optional<std::string> payer_name;
  
  std::optional<std::string> payer_email;
  
  std::optional<std::string> payer_phone;
  
  ::payments::mojom::PaymentAddressPtr shipping_address;
  
  std::optional<std::string> shipping_option;

  // 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, PaymentHandlerResponse::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

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

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

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

template <typename StructPtrType>
CanMakePaymentEventDataPtr CanMakePaymentEventData::Clone() const {
  return New(
      mojo::Clone(top_origin),
      mojo::Clone(payment_request_origin),
      mojo::Clone(method_data),
      mojo::Clone(modifiers)
  );
}

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

template <typename T, CanMakePaymentEventData::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.top_origin < rhs.top_origin)
    return true;
  if (rhs.top_origin < lhs.top_origin)
    return false;
  if (lhs.payment_request_origin < rhs.payment_request_origin)
    return true;
  if (rhs.payment_request_origin < lhs.payment_request_origin)
    return false;
  if (lhs.method_data < rhs.method_data)
    return true;
  if (rhs.method_data < lhs.method_data)
    return false;
  if (lhs.modifiers < rhs.modifiers)
    return true;
  if (rhs.modifiers < lhs.modifiers)
    return false;
  return false;
}
template <typename StructPtrType>
PaymentRequestEventDataPtr PaymentRequestEventData::Clone() const {
  return New(
      mojo::Clone(top_origin),
      mojo::Clone(payment_request_origin),
      mojo::Clone(payment_request_id),
      mojo::Clone(method_data),
      mojo::Clone(total),
      mojo::Clone(modifiers),
      mojo::Clone(instrument_key),
      mojo::Clone(payment_options),
      mojo::Clone(shipping_options),
      mojo::Clone(payment_handler_host)
  );
}

template <typename T, PaymentRequestEventData::EnableIfSame<T>*>
bool PaymentRequestEventData::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->top_origin, other_struct.top_origin))
    return false;
  if (!mojo::Equals(this->payment_request_origin, other_struct.payment_request_origin))
    return false;
  if (!mojo::Equals(this->payment_request_id, other_struct.payment_request_id))
    return false;
  if (!mojo::Equals(this->method_data, other_struct.method_data))
    return false;
  if (!mojo::Equals(this->total, other_struct.total))
    return false;
  if (!mojo::Equals(this->modifiers, other_struct.modifiers))
    return false;
  if (!mojo::Equals(this->instrument_key, other_struct.instrument_key))
    return false;
  if (!mojo::Equals(this->payment_options, other_struct.payment_options))
    return false;
  if (!mojo::Equals(this->shipping_options, other_struct.shipping_options))
    return false;
  if (!mojo::Equals(this->payment_handler_host, other_struct.payment_handler_host))
    return false;
  return true;
}

template <typename T, PaymentRequestEventData::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.top_origin < rhs.top_origin)
    return true;
  if (rhs.top_origin < lhs.top_origin)
    return false;
  if (lhs.payment_request_origin < rhs.payment_request_origin)
    return true;
  if (rhs.payment_request_origin < lhs.payment_request_origin)
    return false;
  if (lhs.payment_request_id < rhs.payment_request_id)
    return true;
  if (rhs.payment_request_id < lhs.payment_request_id)
    return false;
  if (lhs.method_data < rhs.method_data)
    return true;
  if (rhs.method_data < lhs.method_data)
    return false;
  if (lhs.total < rhs.total)
    return true;
  if (rhs.total < lhs.total)
    return false;
  if (lhs.modifiers < rhs.modifiers)
    return true;
  if (rhs.modifiers < lhs.modifiers)
    return false;
  if (lhs.instrument_key < rhs.instrument_key)
    return true;
  if (rhs.instrument_key < lhs.instrument_key)
    return false;
  if (lhs.payment_options < rhs.payment_options)
    return true;
  if (rhs.payment_options < lhs.payment_options)
    return false;
  if (lhs.shipping_options < rhs.shipping_options)
    return true;
  if (rhs.shipping_options < lhs.shipping_options)
    return false;
  if (lhs.payment_handler_host < rhs.payment_handler_host)
    return true;
  if (rhs.payment_handler_host < lhs.payment_handler_host)
    return false;
  return false;
}
template <typename StructPtrType>
CanMakePaymentResponsePtr CanMakePaymentResponse::Clone() const {
  return New(
      mojo::Clone(response_type),
      mojo::Clone(can_make_payment)
  );
}

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

template <typename T, CanMakePaymentResponse::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.response_type < rhs.response_type)
    return true;
  if (rhs.response_type < lhs.response_type)
    return false;
  if (lhs.can_make_payment < rhs.can_make_payment)
    return true;
  if (rhs.can_make_payment < lhs.can_make_payment)
    return false;
  return false;
}
template <typename StructPtrType>
PaymentHandlerResponsePtr PaymentHandlerResponse::Clone() const {
  return New(
      mojo::Clone(method_name),
      mojo::Clone(stringified_details),
      mojo::Clone(response_type),
      mojo::Clone(payer_name),
      mojo::Clone(payer_email),
      mojo::Clone(payer_phone),
      mojo::Clone(shipping_address),
      mojo::Clone(shipping_option)
  );
}

template <typename T, PaymentHandlerResponse::EnableIfSame<T>*>
bool PaymentHandlerResponse::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->method_name, other_struct.method_name))
    return false;
  if (!mojo::Equals(this->stringified_details, other_struct.stringified_details))
    return false;
  if (!mojo::Equals(this->response_type, other_struct.response_type))
    return false;
  if (!mojo::Equals(this->payer_name, other_struct.payer_name))
    return false;
  if (!mojo::Equals(this->payer_email, other_struct.payer_email))
    return false;
  if (!mojo::Equals(this->payer_phone, other_struct.payer_phone))
    return false;
  if (!mojo::Equals(this->shipping_address, other_struct.shipping_address))
    return false;
  if (!mojo::Equals(this->shipping_option, other_struct.shipping_option))
    return false;
  return true;
}

template <typename T, PaymentHandlerResponse::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.method_name < rhs.method_name)
    return true;
  if (rhs.method_name < lhs.method_name)
    return false;
  if (lhs.stringified_details < rhs.stringified_details)
    return true;
  if (rhs.stringified_details < lhs.stringified_details)
    return false;
  if (lhs.response_type < rhs.response_type)
    return true;
  if (rhs.response_type < lhs.response_type)
    return false;
  if (lhs.payer_name < rhs.payer_name)
    return true;
  if (rhs.payer_name < lhs.payer_name)
    return false;
  if (lhs.payer_email < rhs.payer_email)
    return true;
  if (rhs.payer_email < lhs.payer_email)
    return false;
  if (lhs.payer_phone < rhs.payer_phone)
    return true;
  if (rhs.payer_phone < lhs.payer_phone)
    return false;
  if (lhs.shipping_address < rhs.shipping_address)
    return true;
  if (rhs.shipping_address < lhs.shipping_address)
    return false;
  if (lhs.shipping_option < rhs.shipping_option)
    return true;
  if (rhs.shipping_option < lhs.shipping_option)
    return false;
  return false;
}


}  // payments::mojom

namespace mojo {


template <>
struct BLINK_COMMON_EXPORT StructTraits<::payments::mojom::CanMakePaymentEventData::DataView,
                                         ::payments::mojom::CanMakePaymentEventDataPtr> {
  static bool IsNull(const ::payments::mojom::CanMakePaymentEventDataPtr& input) { return !input; }
  static void SetToNull(::payments::mojom::CanMakePaymentEventDataPtr* output) { output->reset(); }

  static const decltype(::payments::mojom::CanMakePaymentEventData::top_origin)& top_origin(
      const ::payments::mojom::CanMakePaymentEventDataPtr& input) {
    return input->top_origin;
  }

  static const decltype(::payments::mojom::CanMakePaymentEventData::payment_request_origin)& payment_request_origin(
      const ::payments::mojom::CanMakePaymentEventDataPtr& input) {
    return input->payment_request_origin;
  }

  static const decltype(::payments::mojom::CanMakePaymentEventData::method_data)& method_data(
      const ::payments::mojom::CanMakePaymentEventDataPtr& input) {
    return input->method_data;
  }

  static const decltype(::payments::mojom::CanMakePaymentEventData::modifiers)& modifiers(
      const ::payments::mojom::CanMakePaymentEventDataPtr& input) {
    return input->modifiers;
  }

  static bool Read(::payments::mojom::CanMakePaymentEventData::DataView input, ::payments::mojom::CanMakePaymentEventDataPtr* output);
};


template <>
struct BLINK_COMMON_EXPORT StructTraits<::payments::mojom::PaymentRequestEventData::DataView,
                                         ::payments::mojom::PaymentRequestEventDataPtr> {
  static bool IsNull(const ::payments::mojom::PaymentRequestEventDataPtr& input) { return !input; }
  static void SetToNull(::payments::mojom::PaymentRequestEventDataPtr* output) { output->reset(); }

  static const decltype(::payments::mojom::PaymentRequestEventData::top_origin)& top_origin(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->top_origin;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::payment_request_origin)& payment_request_origin(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->payment_request_origin;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::payment_request_id)& payment_request_id(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->payment_request_id;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::method_data)& method_data(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->method_data;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::total)& total(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->total;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::modifiers)& modifiers(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->modifiers;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::instrument_key)& instrument_key(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->instrument_key;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::payment_options)& payment_options(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->payment_options;
  }

  static const decltype(::payments::mojom::PaymentRequestEventData::shipping_options)& shipping_options(
      const ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->shipping_options;
  }

  static  decltype(::payments::mojom::PaymentRequestEventData::payment_handler_host)& payment_handler_host(
       ::payments::mojom::PaymentRequestEventDataPtr& input) {
    return input->payment_handler_host;
  }

  static bool Read(::payments::mojom::PaymentRequestEventData::DataView input, ::payments::mojom::PaymentRequestEventDataPtr* output);
};


template <>
struct BLINK_COMMON_EXPORT StructTraits<::payments::mojom::CanMakePaymentResponse::DataView,
                                         ::payments::mojom::CanMakePaymentResponsePtr> {
  static bool IsNull(const ::payments::mojom::CanMakePaymentResponsePtr& input) { return !input; }
  static void SetToNull(::payments::mojom::CanMakePaymentResponsePtr* output) { output->reset(); }

  static decltype(::payments::mojom::CanMakePaymentResponse::response_type) response_type(
      const ::payments::mojom::CanMakePaymentResponsePtr& input) {
    return input->response_type;
  }

  static decltype(::payments::mojom::CanMakePaymentResponse::can_make_payment) can_make_payment(
      const ::payments::mojom::CanMakePaymentResponsePtr& input) {
    return input->can_make_payment;
  }

  static bool Read(::payments::mojom::CanMakePaymentResponse::DataView input, ::payments::mojom::CanMakePaymentResponsePtr* output);
};


template <>
struct BLINK_COMMON_EXPORT StructTraits<::payments::mojom::PaymentHandlerResponse::DataView,
                                         ::payments::mojom::PaymentHandlerResponsePtr> {
  static bool IsNull(const ::payments::mojom::PaymentHandlerResponsePtr& input) { return !input; }
  static void SetToNull(::payments::mojom::PaymentHandlerResponsePtr* output) { output->reset(); }

  static const decltype(::payments::mojom::PaymentHandlerResponse::method_name)& method_name(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->method_name;
  }

  static const decltype(::payments::mojom::PaymentHandlerResponse::stringified_details)& stringified_details(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->stringified_details;
  }

  static decltype(::payments::mojom::PaymentHandlerResponse::response_type) response_type(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->response_type;
  }

  static const decltype(::payments::mojom::PaymentHandlerResponse::payer_name)& payer_name(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->payer_name;
  }

  static const decltype(::payments::mojom::PaymentHandlerResponse::payer_email)& payer_email(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->payer_email;
  }

  static const decltype(::payments::mojom::PaymentHandlerResponse::payer_phone)& payer_phone(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->payer_phone;
  }

  static const decltype(::payments::mojom::PaymentHandlerResponse::shipping_address)& shipping_address(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->shipping_address;
  }

  static const decltype(::payments::mojom::PaymentHandlerResponse::shipping_option)& shipping_option(
      const ::payments::mojom::PaymentHandlerResponsePtr& input) {
    return input->shipping_option;
  }

  static bool Read(::payments::mojom::PaymentHandlerResponse::DataView input, ::payments::mojom::PaymentHandlerResponsePtr* output);
};

}  // namespace mojo

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_PAYMENTS_PAYMENT_APP_EVENTS_MOJOM_H_