// services/network/public/mojom/declarative_performance_observer.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_DECLARATIVE_PERFORMANCE_OBSERVER_MOJOM_SEND_VALIDATION_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_DECLARATIVE_PERFORMANCE_OBSERVER_MOJOM_SEND_VALIDATION_H_

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

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

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

namespace mojo::internal {
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::network::mojom::PerformanceEntryType, MaybeConstUserType>
    : std::false_type {};

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

      decltype(Traits::reporting_endpoint(input)) in_reporting_endpoint = Traits::reporting_endpoint(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->reporting_endpoint)::BaseType> reporting_endpoint_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_reporting_endpoint,
        reporting_endpoint_fragment);

      fragment->reporting_endpoint.Set(
          reporting_endpoint_fragment.is_null() ? nullptr : reporting_endpoint_fragment.data());

      decltype(Traits::entry_types(input)) in_entry_types = Traits::entry_types(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->entry_types)::BaseType>
          entry_types_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& entry_types_validate_params =
          mojo::internal::GetArrayOfEnumsValidator<0, false, ::network::mojom::internal::PerformanceEntryType_Data::Validate>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::network::mojom::PerformanceEntryType>, send_validation>(
        in_entry_types,
        entry_types_fragment,
        &entry_types_validate_params);

      fragment->entry_types.Set(
          entry_types_fragment.is_null() ? nullptr : entry_types_fragment.data());

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

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

      fragment->include_user_timing.Set(
          include_user_timing_fragment.is_null() ? nullptr : include_user_timing_fragment.data());

      fragment->capture_early_failures = Traits::capture_early_failures(input);
  }
};

}  // namespace mojo::internal

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_DECLARATIVE_PERFORMANCE_OBSERVER_MOJOM_SEND_VALIDATION_H_