// services/network/public/mojom/proxy_config_with_annotation.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 SERVICES_NETWORK_PUBLIC_MOJOM_PROXY_CONFIG_WITH_ANNOTATION_MOJOM_BLINK_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_PROXY_CONFIG_WITH_ANNOTATION_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 "services/network/public/mojom/proxy_config_with_annotation.mojom-features.h"  // IWYU pragma: export
#include "services/network/public/mojom/proxy_config_with_annotation.mojom-shared.h"  // IWYU pragma: export
#include "services/network/public/mojom/proxy_config_with_annotation.mojom-blink-forward.h"  // IWYU pragma: export
#include "services/network/public/mojom/mutable_network_traffic_annotation_tag.mojom-blink.h"
#include "services/network/public/mojom/proxy_config.mojom-blink.h"

#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"


#if !BLINK_MOJO_IMPL && !INSIDE_BLINK
#error "File must only be imported inside blink"
#endif




namespace network::mojom::blink {

class ProxyConfigClientProxy;

template <typename ImplRefTraits>
class ProxyConfigClientStub;

class ProxyConfigClientRequestValidator;
class ProxyConfigClientResponseValidator;


class ProxyConfigClient
    : public ProxyConfigClientInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "network.mojom.ProxyConfigClient";
  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_ = ProxyConfigClientInterfaceBase;
  using Proxy_ = ProxyConfigClientProxy;

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

  using RequestValidator_ = ProxyConfigClientRequestValidator;
  using ResponseValidator_ = ProxyConfigClientResponseValidator;
  enum MethodMinVersions : uint32_t {
    kOnProxyConfigUpdatedMinVersion = 0,
    kFlushProxyConfigMinVersion = 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 OnProxyConfigUpdated_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct FlushProxyConfig_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~ProxyConfigClient() = default;

  virtual void OnProxyConfigUpdated(ProxyConfigWithAnnotationPtr proxy_config) = 0;

  using FlushProxyConfigCallback = base::OnceCallback<void()>;
  using FlushProxyConfigMojoCallback = base::OnceCallback<void()>;

  virtual void FlushProxyConfig(FlushProxyConfigCallback callback) = 0;
};

class ProxyConfigPollerClientProxy;

template <typename ImplRefTraits>
class ProxyConfigPollerClientStub;

class ProxyConfigPollerClientRequestValidator;


class ProxyConfigPollerClient
    : public ProxyConfigPollerClientInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "network.mojom.ProxyConfigPollerClient";
  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_ = ProxyConfigPollerClientInterfaceBase;
  using Proxy_ = ProxyConfigPollerClientProxy;

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

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

  virtual void OnLazyProxyConfigPoll() = 0;
};

class ProxyErrorClientProxy;

template <typename ImplRefTraits>
class ProxyErrorClientStub;

class ProxyErrorClientRequestValidator;


class ProxyErrorClient
    : public ProxyErrorClientInterfaceBase {
 public:
  using IPCStableHashFunction = uint32_t(*)();
  static constexpr const char* Name_ = "network.mojom.ProxyErrorClient";
  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_ = ProxyErrorClientInterfaceBase;
  using Proxy_ = ProxyErrorClientProxy;

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

  using RequestValidator_ = ProxyErrorClientRequestValidator;
  using ResponseValidator_ = mojo::PassThroughFilter;
  enum MethodMinVersions : uint32_t {
    kOnPACScriptErrorMinVersion = 0,
    kOnRequestMaybeFailedDueToProxySettingsMinVersion = 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 OnPACScriptError_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
  struct OnRequestMaybeFailedDueToProxySettings_Sym {
    NOINLINE static uint32_t IPCStableHash();
  };
#endif // !BUILDFLAG(IS_FUCHSIA)
  virtual ~ProxyErrorClient() = default;

  virtual void OnPACScriptError(int32_t line_number, const ::blink::String& details) = 0;

  virtual void OnRequestMaybeFailedDueToProxySettings(int32_t net_error) = 0;
};



class  ProxyConfigClientProxy
    : public ProxyConfigClient {
 public:
  using InterfaceType = ProxyConfigClient;

  explicit ProxyConfigClientProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void OnProxyConfigUpdated(ProxyConfigWithAnnotationPtr proxy_config) final;
  
  void FlushProxyConfig(FlushProxyConfigCallback callback) final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class  ProxyConfigPollerClientProxy
    : public ProxyConfigPollerClient {
 public:
  using InterfaceType = ProxyConfigPollerClient;

  explicit ProxyConfigPollerClientProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void OnLazyProxyConfigPoll() final;

 private:
  mojo::MessageReceiverWithResponder* receiver_;
};



class  ProxyErrorClientProxy
    : public ProxyErrorClient {
 public:
  using InterfaceType = ProxyErrorClient;

  explicit ProxyErrorClientProxy(mojo::MessageReceiverWithResponder* receiver);
  
  void OnPACScriptError(int32_t line_number, const ::blink::String& details) final;
  
  void OnRequestMaybeFailedDueToProxySettings(int32_t net_error) final;

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

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

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

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

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

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

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

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

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

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

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

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

 private:
  ImplPointerType sink_;
};
class  ProxyConfigClientRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class  ProxyConfigPollerClientRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class  ProxyErrorClientRequestValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};
class  ProxyConfigClientResponseValidator : public mojo::MessageReceiver {
 public:
  bool Accept(mojo::Message* message) override;
};








class  ProxyConfigWithAnnotation {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<ProxyConfigWithAnnotation, T>::value>;
  using DataView = ProxyConfigWithAnnotationDataView;
  using Data_ = internal::ProxyConfigWithAnnotation_Data;

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

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

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


  ProxyConfigWithAnnotation();

  ProxyConfigWithAnnotation(
      ::network::mojom::blink::ProxyConfigPtr value,
      const ::net::MutableNetworkTrafficAnnotationTag& traffic_annotation);

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

  ~ProxyConfigWithAnnotation();

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

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

  template <typename T, ProxyConfigWithAnnotation::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<
        ProxyConfigWithAnnotation::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::ProxyConfigWithAnnotation_UnserializedMessageContext<
            UserType, ProxyConfigWithAnnotation::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<ProxyConfigWithAnnotation::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

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

  
  ::network::mojom::blink::ProxyConfigPtr value;
  
  ::net::MutableNetworkTrafficAnnotationTag traffic_annotation;

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

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

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

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

template <typename StructPtrType>
ProxyConfigWithAnnotationPtr ProxyConfigWithAnnotation::Clone() const {
  return New(
      mojo::Clone(value),
      mojo::Clone(traffic_annotation)
  );
}

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

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


}  // network::mojom::blink

namespace mojo {


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

  static  decltype(::network::mojom::blink::ProxyConfigWithAnnotation::value)& value(
       ::network::mojom::blink::ProxyConfigWithAnnotationPtr& input) {
    return input->value;
  }

  static const decltype(::network::mojom::blink::ProxyConfigWithAnnotation::traffic_annotation)& traffic_annotation(
      const ::network::mojom::blink::ProxyConfigWithAnnotationPtr& input) {
    return input->traffic_annotation;
  }

  static bool Read(::network::mojom::blink::ProxyConfigWithAnnotation::DataView input, ::network::mojom::blink::ProxyConfigWithAnnotationPtr* output);
};

}  // namespace mojo

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_PROXY_CONFIG_WITH_ANNOTATION_MOJOM_BLINK_H_