// services/network/public/mojom/load_timing_internal_info.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_LOAD_TIMING_INTERNAL_INFO_MOJOM_DATA_VIEW_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_LOAD_TIMING_INTERNAL_INFO_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/load_timing_internal_info.mojom-shared-internal.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"


namespace network::mojom {
class DohResolutionDetailsDataView;

class ResolutionDetailsDataView;

class LoadTimingInternalInfoDataView;



}  // network::mojom


namespace mojo {
namespace internal {

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

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

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

}  // namespace internal
}  // namespace mojo


namespace network::mojom {


enum class SessionSource : int32_t {
  
  kNew = 0,
  
  kExisting = 1,
  kMinValue = 0,
  kMaxValue = 1,
};

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

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


enum class AdvertisedAltSvcState : int32_t {
  
  kUnknown = 0,
  
  kQuicNotBroken = 1,
  
  kQuicBroken = 2,
  kMinValue = 0,
  kMaxValue = 2,
};

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

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


enum class ResolutionSource : int32_t {
  
  kUnknown = 0,
  
  kCache = 1,
  
  kLocal = 2,
  
  kInsecure = 3,
  
  kSecure = 4,
  
  kSystem = 5,
  
  kPlatform = 6,
  
  kMdns = 7,
  
  kNat64 = 8,
  kMinValue = 0,
  kMaxValue = 8,
};

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

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


enum class NextProto : int32_t {
  
  kProtoUnknown = 0,
  
  kProtoHTTP11 = 1,
  
  kProtoHTTP2 = 2,
  
  kProtoQUIC = 3,
  kMinValue = 0,
  kMaxValue = 3,
};

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

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


enum class HttpConnectionInfoCoarse : int32_t {
  
  kHTTP1 = 0,
  
  kHTTP2 = 1,
  
  kQUIC = 2,
  
  kOTHER = 3,
  kMinValue = 0,
  kMaxValue = 3,
};

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

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


class DohResolutionDetailsDataView {
 public:
  DohResolutionDetailsDataView() = default;

  DohResolutionDetailsDataView(
      internal::DohResolutionDetails_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  template <typename UserType>
  [[nodiscard]] bool ReadSessionSource(UserType* output) const {
    auto data_value = data_->session_source;
    return mojo::internal::Deserialize<::network::mojom::SessionSource>(
        data_value, output);
  }
  SessionSource session_source() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::SessionSource>(data_->session_source));
  }
  template <typename UserType>
  [[nodiscard]] bool ReadConnectionInfo(UserType* output) const {
    auto data_value = data_->connection_info;
    return mojo::internal::Deserialize<::network::mojom::HttpConnectionInfoCoarse>(
        data_value, output);
  }
  HttpConnectionInfoCoarse connection_info() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::HttpConnectionInfoCoarse>(data_->connection_info));
  }
 private:
  internal::DohResolutionDetails_Data* data_ = nullptr;
};


class ResolutionDetailsDataView {
 public:
  ResolutionDetailsDataView() = default;

  ResolutionDetailsDataView(
      internal::ResolutionDetails_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

  template <typename UserType>
  [[nodiscard]] bool ReadTaskCompletionDelay(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::mojo_base::mojom::TimeDeltaDataView, UserType>(),
    "Attempting to read the optional `task_completion_delay` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadTaskCompletionDelay` instead "
    "of `ReadTaskCompletionDelay if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->task_completion_delay.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TimeDeltaDataView>(
        pointer, output, message_);
  }
  bool secure_dns_attempted() const {
    return data_->secure_dns_attempted;
  }
  inline void GetDohDetailsDataView(
      DohResolutionDetailsDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadDohDetails(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::network::mojom::DohResolutionDetailsDataView, UserType>(),
    "Attempting to read the optional `doh_details` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadDohDetails` instead "
    "of `ReadDohDetails if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->doh_details.Get();
    return mojo::internal::Deserialize<::network::mojom::DohResolutionDetailsDataView>(
        pointer, output, message_);
  }
 private:
  internal::ResolutionDetails_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class LoadTimingInternalInfoDataView {
 public:
  LoadTimingInternalInfoDataView() = default;

  LoadTimingInternalInfoDataView(
      internal::LoadTimingInternalInfo_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetMaxStreamLimitPendingDelayDataView(
      ::mojo_base::mojom::TimeDeltaDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadMaxStreamLimitPendingDelay(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::mojo_base::mojom::TimeDeltaDataView, UserType>(),
    "Attempting to read the optional `max_stream_limit_pending_delay` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadMaxStreamLimitPendingDelay` instead "
    "of `ReadMaxStreamLimitPendingDelay if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->max_stream_limit_pending_delay.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TimeDeltaDataView>(
        pointer, output, message_);
  }
  inline void GetCreateStreamDelayDataView(
      ::mojo_base::mojom::TimeDeltaDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadCreateStreamDelay(UserType* output) {
    
    auto* pointer = data_->create_stream_delay.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TimeDeltaDataView>(
        pointer, output, message_);
  }
  inline void GetConnectedCallbackDelayDataView(
      ::mojo_base::mojom::TimeDeltaDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadConnectedCallbackDelay(UserType* output) {
    
    auto* pointer = data_->connected_callback_delay.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TimeDeltaDataView>(
        pointer, output, message_);
  }
  bool accept_ch_frame_received() const {
    return data_->accept_ch_frame_received;
  }
  inline void GetInitializeStreamDelayDataView(
      ::mojo_base::mojom::TimeDeltaDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadInitializeStreamDelay(UserType* output) {
    
    auto* pointer = data_->initialize_stream_delay.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TimeDeltaDataView>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadSessionSource(UserType* output) const {
    if (!data_->session_source_$flag) {
      *output = std::nullopt;
      return true;
    }

    return mojo::internal::Deserialize<::network::mojom::SessionSource>(
        data_->session_source_$value, &output->emplace());
  }
  std::optional<SessionSource> session_source() const {
    if (!data_->session_source_$flag) {
      return std::nullopt;
    }
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::SessionSource>(data_->session_source_$value));
  }
  template <typename UserType>
  [[nodiscard]] bool ReadAdvertisedAltSvcState(UserType* output) const {
    auto data_value = data_->advertised_alt_svc_state;
    return mojo::internal::Deserialize<::network::mojom::AdvertisedAltSvcState>(
        data_value, output);
  }
  AdvertisedAltSvcState advertised_alt_svc_state() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::AdvertisedAltSvcState>(data_->advertised_alt_svc_state));
  }
  bool http_network_session_quic_enabled() const {
    return data_->http_network_session_quic_enabled;
  }
  inline void GetResolutionDetailsDataView(
      ResolutionDetailsDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadResolutionDetails(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::network::mojom::ResolutionDetailsDataView, UserType>(),
    "Attempting to read the optional `resolution_details` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadResolutionDetails` instead "
    "of `ReadResolutionDetails if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->resolution_details.Get();
    return mojo::internal::Deserialize<::network::mojom::ResolutionDetailsDataView>(
        pointer, output, message_);
  }
 private:
  internal::LoadTimingInternalInfo_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // network::mojom

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_LOAD_TIMING_INTERNAL_INFO_MOJOM_DATA_VIEW_H_