// services/network/public/mojom/connection_endpoint_metadata.mojom-send-validation.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.

#ifndef SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_ENDPOINT_METADATA_MOJOM_SEND_VALIDATION_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_ENDPOINT_METADATA_MOJOM_SEND_VALIDATION_H_

#include "services/network/public/mojom/connection_endpoint_metadata.mojom-shared-internal.h"

#include "services/network/public/mojom/connection_endpoint_metadata.mojom-data-view.h"

#include "mojo/public/cpp/bindings/lib/send_validation_type.h"
#include "mojo/public/cpp/bindings/lib/send_validation.h"

namespace mojo::internal {

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::network::mojom::ConnectionEndpointMetadataDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::network::mojom::ConnectionEndpointMetadataDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::network::mojom::internal::ConnectionEndpointMetadata_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::supported_protocol_alpns(input)) in_supported_protocol_alpns = Traits::supported_protocol_alpns(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->supported_protocol_alpns)::BaseType>
          supported_protocol_alpns_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& supported_protocol_alpns_validate_params =
          mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<mojo::StringDataView>, send_validation>(
        in_supported_protocol_alpns,
        supported_protocol_alpns_fragment,
        &supported_protocol_alpns_validate_params);

      fragment->supported_protocol_alpns.Set(
          supported_protocol_alpns_fragment.is_null() ? nullptr : supported_protocol_alpns_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->supported_protocol_alpns.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null supported_protocol_alpns in ConnectionEndpointMetadata struct");

      decltype(Traits::ech_config_list(input)) in_ech_config_list = Traits::ech_config_list(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->ech_config_list)::BaseType>
          ech_config_list_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& ech_config_list_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>, send_validation>(
        in_ech_config_list,
        ech_config_list_fragment,
        &ech_config_list_validate_params);

      fragment->ech_config_list.Set(
          ech_config_list_fragment.is_null() ? nullptr : ech_config_list_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->ech_config_list.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null ech_config_list in ConnectionEndpointMetadata struct");

      decltype(Traits::target_name(input)) in_target_name = Traits::target_name(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->target_name)::BaseType> target_name_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_target_name,
        target_name_fragment);

      fragment->target_name.Set(
          target_name_fragment.is_null() ? nullptr : target_name_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->target_name.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null target_name in ConnectionEndpointMetadata struct");

      decltype(Traits::trust_anchor_ids(input)) in_trust_anchor_ids = Traits::trust_anchor_ids(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->trust_anchor_ids)::BaseType>
          trust_anchor_ids_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& trust_anchor_ids_validate_params =
          mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<mojo::ArrayDataView<uint8_t>>, send_validation>(
        in_trust_anchor_ids,
        trust_anchor_ids_fragment,
        &trust_anchor_ids_validate_params);

      fragment->trust_anchor_ids.Set(
          trust_anchor_ids_fragment.is_null() ? nullptr : trust_anchor_ids_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->trust_anchor_ids.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null trust_anchor_ids in ConnectionEndpointMetadata struct");
  }
};

}  // namespace mojo::internal

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_CONNECTION_ENDPOINT_METADATA_MOJOM_SEND_VALIDATION_H_