// services/network/public/mojom/connection_allowlist.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_ALLOWLIST_MOJOM_DATA_VIEW_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_ALLOWLIST_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_allowlist.mojom-shared-internal.h"
#include "mojo/public/mojom/base/unguessable_token.mojom-shared.h"
#include "url/mojom/url.mojom-shared.h"


namespace network::mojom {
class ConnectionAllowlistDataView;

class ConnectionAllowlistsDataView;



}  // network::mojom


namespace mojo {
namespace internal {

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

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

}  // namespace internal
}  // namespace mojo


namespace network::mojom {


enum class ConnectionAllowlistIssue : int32_t {
  
  kInvalidHeader = 0,
  
  kMoreThanOneList = 1,
  
  kItemNotInnerList = 2,
  
  kInvalidAllowlistItemType = 3,
  
  kReportingEndpointNotToken = 4,
  
  kInvalidUrlPattern = 5,
  kMinValue = 0,
  kMaxValue = 5,
};

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

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


enum class RedirectBehavior : int32_t {
  
  kAllow = 0,
  
  kBlock = 1,
  kMinValue = 0,
  kMaxValue = 1,
};

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

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


enum class WebRtcBehavior : int32_t {
  
  kAllow = 0,
  
  kBlock = 1,
  kMinValue = 0,
  kMaxValue = 1,
};

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

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


class ConnectionAllowlistDataView {
 public:
  ConnectionAllowlistDataView() = default;

  ConnectionAllowlistDataView(
      internal::ConnectionAllowlist_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetAllowlistDataView(
      mojo::ArrayDataView<mojo::StringDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadAllowlist(UserType* output) {
    
    auto* pointer = data_->allowlist.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<mojo::StringDataView>>(
        pointer, output, message_);
  }
  inline void GetReportingEndpointDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadReportingEndpoint(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::StringDataView, UserType>(),
    "Attempting to read the optional `reporting_endpoint` 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 `MaybeReadReportingEndpoint` instead "
    "of `ReadReportingEndpoint if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->reporting_endpoint.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetIssuesDataView(
      mojo::ArrayDataView<ConnectionAllowlistIssue>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadIssues(UserType* output) {
    
    auto* pointer = data_->issues.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::network::mojom::ConnectionAllowlistIssue>>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadRedirectBehavior(UserType* output) const {
    auto data_value = data_->redirect_behavior;
    return mojo::internal::Deserialize<::network::mojom::RedirectBehavior>(
        data_value, output);
  }
  RedirectBehavior redirect_behavior() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::RedirectBehavior>(data_->redirect_behavior));
  }
  template <typename UserType>
  [[nodiscard]] bool ReadWebrtcBehavior(UserType* output) const {
    auto data_value = data_->webrtc_behavior;
    return mojo::internal::Deserialize<::network::mojom::WebRtcBehavior>(
        data_value, output);
  }
  WebRtcBehavior webrtc_behavior() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::WebRtcBehavior>(data_->webrtc_behavior));
  }
  bool match_response_origin() const {
    return data_->match_response_origin;
  }
  inline void GetSerializedValueDataView(
      mojo::StringDataView* output);

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


class ConnectionAllowlistsDataView {
 public:
  ConnectionAllowlistsDataView() = default;

  ConnectionAllowlistsDataView(
      internal::ConnectionAllowlists_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetResponseUrlDataView(
      ::url::mojom::UrlDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadResponseUrl(UserType* output) {
    
    auto* pointer = data_->response_url.Get();
    return mojo::internal::Deserialize<::url::mojom::UrlDataView>(
        pointer, output, message_);
  }
  inline void GetEnforcedDataView(
      ConnectionAllowlistDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadEnforced(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::network::mojom::ConnectionAllowlistDataView, UserType>(),
    "Attempting to read the optional `enforced` 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 `MaybeReadEnforced` instead "
    "of `ReadEnforced if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->enforced.Get();
    return mojo::internal::Deserialize<::network::mojom::ConnectionAllowlistDataView>(
        pointer, output, message_);
  }
  inline void GetReportOnlyDataView(
      ConnectionAllowlistDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadReportOnly(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::network::mojom::ConnectionAllowlistDataView, UserType>(),
    "Attempting to read the optional `report_only` 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 `MaybeReadReportOnly` instead "
    "of `ReadReportOnly if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->report_only.Get();
    return mojo::internal::Deserialize<::network::mojom::ConnectionAllowlistDataView>(
        pointer, output, message_);
  }
  inline void GetReportingSourceDataView(
      ::mojo_base::mojom::UnguessableTokenDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadReportingSource(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::mojo_base::mojom::UnguessableTokenDataView, UserType>(),
    "Attempting to read the optional `reporting_source` 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 `MaybeReadReportingSource` instead "
    "of `ReadReportingSource if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->reporting_source.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::UnguessableTokenDataView>(
        pointer, output, message_);
  }
 private:
  internal::ConnectionAllowlists_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // network::mojom

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_ALLOWLIST_MOJOM_DATA_VIEW_H_