// services/network/public/mojom/ct_policy.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_CT_POLICY_MOJOM_SEND_VALIDATION_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_CT_POLICY_MOJOM_SEND_VALIDATION_H_

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

#include "services/network/public/mojom/ct_policy.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::CTPolicyDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::network::mojom::CTPolicyDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::network::mojom::internal::CTPolicy_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

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

      fragment->excluded_hosts.Set(
          excluded_hosts_fragment.is_null() ? nullptr : excluded_hosts_fragment.data());

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

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

      fragment->excluded_spkis.Set(
          excluded_spkis_fragment.is_null() ? nullptr : excluded_spkis_fragment.data());

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

}  // namespace mojo::internal

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_CT_POLICY_MOJOM_SEND_VALIDATION_H_