// services/service_manager/public/mojom/service.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_SERVICE_MANAGER_PUBLIC_MOJOM_SERVICE_MOJOM_SEND_VALIDATION_H_
#define SERVICES_SERVICE_MANAGER_PUBLIC_MOJOM_SERVICE_MOJOM_SEND_VALIDATION_H_

#include "services/service_manager/public/mojom/service.mojom-shared-internal.h"
#include "services/service_manager/public/mojom/connector.mojom-shared.h"
#include "services/service_manager/public/mojom/interface_provider.mojom-shared.h"
#include "services/service_manager/public/mojom/interface_provider_spec.mojom-shared.h"
#include "services/service_manager/public/mojom/service_control.mojom-shared.h"

#include "services/service_manager/public/mojom/service.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/interface_serialization_send_validation.h"

namespace mojo::internal {

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

      decltype(Traits::identity(input)) in_identity = Traits::identity(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->identity)::BaseType> identity_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::service_manager::mojom::IdentityDataView, send_validation>(
        in_identity,
        identity_fragment);

      fragment->identity.Set(
          identity_fragment.is_null() ? nullptr : identity_fragment.data());

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

      decltype(Traits::required_capabilities(input)) in_required_capabilities = Traits::required_capabilities(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->required_capabilities)::BaseType> required_capabilities_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::service_manager::mojom::CapabilitySetDataView, send_validation>(
        in_required_capabilities,
        required_capabilities_fragment);

      fragment->required_capabilities.Set(
          required_capabilities_fragment.is_null() ? nullptr : required_capabilities_fragment.data());

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

}  // namespace mojo::internal

#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_MOJOM_SERVICE_MOJOM_SEND_VALIDATION_H_