// services/network/public/mojom/connection_change_observer_client.mojom-data-view.h is auto generated by mojom_bindings_generator.py, do not edit

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

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_CHANGE_OBSERVER_CLIENT_MOJOM_DATA_VIEW_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_CHANGE_OBSERVER_CLIENT_MOJOM_DATA_VIEW_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "services/network/public/mojom/connection_change_observer_client.mojom-shared-internal.h"
#include "services/network/public/mojom/load_timing_internal_info.mojom-shared.h"
#include "services/network/public/mojom/network_types.mojom-shared.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"


namespace network::mojom {
class EstablishedConnectionInfoDataView;

class ConnectionKeepAliveConfigDataView;



}  // network::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::network::mojom::EstablishedConnectionInfoDataView> {
  using Data = ::network::mojom::internal::EstablishedConnectionInfo_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::network::mojom::ConnectionKeepAliveConfigDataView> {
  using Data = ::network::mojom::internal::ConnectionKeepAliveConfig_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace network::mojom {


enum class ConnectionEstablishmentInitiator : int32_t {
  
  kPreconnect = 0,
  
  kRequest = 1,
  kMinValue = 0,
  kMaxValue = 1,
};

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

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(ConnectionEstablishmentInitiator) {
  return true;
}


enum class NetworkChangeEvent : int32_t {
  
  kSoonToDisconnect = 0,
  
  kDisconnected = 1,
  
  kConnected = 2,
  
  kDefaultNetworkChanged = 3,
  kMinValue = 0,
  kMaxValue = 3,
};

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

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

using ConnectionChangeObserverClientPtrDataView =
    mojo::InterfacePtrDataView<ConnectionChangeObserverClientInterfaceBase>;
using ConnectionChangeObserverClientRequestDataView =
    mojo::InterfaceRequestDataView<ConnectionChangeObserverClientInterfaceBase>;
using ConnectionChangeObserverClientAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ConnectionChangeObserverClientInterfaceBase>;
using ConnectionChangeObserverClientAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ConnectionChangeObserverClientInterfaceBase>;


class EstablishedConnectionInfoDataView {
 public:
  EstablishedConnectionInfoDataView() = default;

  EstablishedConnectionInfoDataView(
      internal::EstablishedConnectionInfo_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  template <typename UserType>
  [[nodiscard]] bool ReadConnectionInfo(UserType* output) const {
    auto data_value = data_->connection_info;
    return mojo::internal::Deserialize<::network::mojom::NextProto>(
        data_value, output);
  }
  ::network::mojom::NextProto connection_info() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::NextProto>(data_->connection_info));
  }
  inline void GetConnectionSetupTimeDataView(
      ::mojo_base::mojom::TimeDeltaDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadConnectionSetupTime(UserType* output) {
    
    auto* pointer = data_->connection_setup_time.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TimeDeltaDataView>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadInitiator(UserType* output) const {
    auto data_value = data_->initiator;
    return mojo::internal::Deserialize<::network::mojom::ConnectionEstablishmentInitiator>(
        data_value, output);
  }
  ConnectionEstablishmentInitiator initiator() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::ConnectionEstablishmentInitiator>(data_->initiator));
  }
 private:
  internal::EstablishedConnectionInfo_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class ConnectionKeepAliveConfigDataView {
 public:
  ConnectionKeepAliveConfigDataView() = default;

  ConnectionKeepAliveConfigDataView(
      internal::ConnectionKeepAliveConfig_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  int32_t idle_timeout_in_seconds() const {
    return data_->idle_timeout_in_seconds;
  }
  int32_t ping_interval_in_seconds() const {
    return data_->ping_interval_in_seconds;
  }
  bool enable_connection_keep_alive() const {
    return data_->enable_connection_keep_alive;
  }
  inline void GetQuicConnectionOptionsDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadQuicConnectionOptions(UserType* output) {
    
    auto* pointer = data_->quic_connection_options.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
 private:
  internal::ConnectionKeepAliveConfig_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // network::mojom

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_CHANGE_OBSERVER_CLIENT_MOJOM_DATA_VIEW_H_