// mojo/public/interfaces/bindings/interface_control_messages.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 MOJO_PUBLIC_INTERFACES_BINDINGS_INTERFACE_CONTROL_MESSAGES_MOJOM_SEND_VALIDATION_H_
#define MOJO_PUBLIC_INTERFACES_BINDINGS_INTERFACE_CONTROL_MESSAGES_MOJOM_SEND_VALIDATION_H_

#include "mojo/public/interfaces/bindings/interface_control_messages.mojom-shared-internal.h"

#include "mojo/public/interfaces/bindings/interface_control_messages.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<::mojo::interface_control::RunMessageParamsDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::mojo::interface_control::RunMessageParamsDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::mojo::interface_control::internal::RunMessageParams_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::input(input)) in_input = Traits::input(input);
      mojo::internal::MessageFragment<decltype(fragment->input)>
          input_fragment(fragment.message());
      input_fragment.Claim(&fragment->input);
      
      mojo::internal::Serialize<::mojo::interface_control::RunInputDataView, send_validation>(
        in_input,
        input_fragment,
        true);

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

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

      decltype(Traits::output(input)) in_output = Traits::output(input);
      mojo::internal::MessageFragment<decltype(fragment->output)>
          output_fragment(fragment.message());
      output_fragment.Claim(&fragment->output);
      
      mojo::internal::Serialize<::mojo::interface_control::RunOutputDataView, send_validation>(
        in_output,
        output_fragment,
        true);
  }
};

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

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

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

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

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

      decltype(Traits::input(input)) in_input = Traits::input(input);
      mojo::internal::MessageFragment<decltype(fragment->input)>
          input_fragment(fragment.message());
      input_fragment.Claim(&fragment->input);
      
      mojo::internal::Serialize<::mojo::interface_control::RunOrClosePipeInputDataView, send_validation>(
        in_input,
        input_fragment,
        true);

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

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

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

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

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

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

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::mojo::interface_control::NotifyIdleDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::mojo::interface_control::NotifyIdleDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::mojo::interface_control::internal::NotifyIdle_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();
  }
};
template <typename MaybeConstUserType, SendValidation send_validation>
struct SendValidationSerializer<::mojo::interface_control::RunInputDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = UnionTraits<::mojo::interface_control::RunInputDataView, UserType>;
  static void Serialize(MaybeConstUserType& input,
                        MessageFragment<::mojo::interface_control::internal::RunInput_Data>& fragment,
                        bool inlined) {
    
    if (CallIsNullIfExists<Traits>(input)) {
       if (inlined)
        fragment->set_null();
      return;
    }

if (!inlined)
  fragment.Allocate();

    // TODO(azani): Handle unknown and objects.
    // Set the not-null flag.
fragment->size = kUnionDataSize;
fragment->tag = Traits::GetTag(input);
switch (fragment->tag) {
  case ::mojo::interface_control::RunInputDataView::Tag::kQueryVersion: {
    decltype(Traits::query_version(input))
    in_query_version = Traits::query_version(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_query_version)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::mojo::interface_control::QueryVersionDataView, send_validation>(
  in_query_version,
  value_fragment);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null query_version in RunInput union");
    fragment->data.f_query_version.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
  case ::mojo::interface_control::RunInputDataView::Tag::kFlushForTesting: {
    decltype(Traits::flush_for_testing(input))
    in_flush_for_testing = Traits::flush_for_testing(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_flush_for_testing)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::mojo::interface_control::FlushForTestingDataView, send_validation>(
  in_flush_for_testing,
  value_fragment);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null flush_for_testing in RunInput union");
    fragment->data.f_flush_for_testing.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
}
  }
};
template <typename MaybeConstUserType, SendValidation send_validation>
struct SendValidationSerializer<::mojo::interface_control::RunOutputDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = UnionTraits<::mojo::interface_control::RunOutputDataView, UserType>;
  static void Serialize(MaybeConstUserType& input,
                        MessageFragment<::mojo::interface_control::internal::RunOutput_Data>& fragment,
                        bool inlined) {
    
    if (CallIsNullIfExists<Traits>(input)) {
       if (inlined)
        fragment->set_null();
      return;
    }

if (!inlined)
  fragment.Allocate();

    // TODO(azani): Handle unknown and objects.
    // Set the not-null flag.
fragment->size = kUnionDataSize;
fragment->tag = Traits::GetTag(input);
switch (fragment->tag) {
  case ::mojo::interface_control::RunOutputDataView::Tag::kQueryVersionResult: {
    decltype(Traits::query_version_result(input))
    in_query_version_result = Traits::query_version_result(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_query_version_result)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::mojo::interface_control::QueryVersionResultDataView, send_validation>(
  in_query_version_result,
  value_fragment);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null query_version_result in RunOutput union");
    fragment->data.f_query_version_result.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
}
  }
};
template <typename MaybeConstUserType, SendValidation send_validation>
struct SendValidationSerializer<::mojo::interface_control::RunOrClosePipeInputDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = UnionTraits<::mojo::interface_control::RunOrClosePipeInputDataView, UserType>;
  static void Serialize(MaybeConstUserType& input,
                        MessageFragment<::mojo::interface_control::internal::RunOrClosePipeInput_Data>& fragment,
                        bool inlined) {
    
    if (CallIsNullIfExists<Traits>(input)) {
       if (inlined)
        fragment->set_null();
      return;
    }

if (!inlined)
  fragment.Allocate();

    // TODO(azani): Handle unknown and objects.
    // Set the not-null flag.
fragment->size = kUnionDataSize;
fragment->tag = Traits::GetTag(input);
switch (fragment->tag) {
  case ::mojo::interface_control::RunOrClosePipeInputDataView::Tag::kRequireVersion: {
    decltype(Traits::require_version(input))
    in_require_version = Traits::require_version(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_require_version)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::mojo::interface_control::RequireVersionDataView, send_validation>(
  in_require_version,
  value_fragment);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null require_version in RunOrClosePipeInput union");
    fragment->data.f_require_version.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
  case ::mojo::interface_control::RunOrClosePipeInputDataView::Tag::kEnableIdleTracking: {
    decltype(Traits::enable_idle_tracking(input))
    in_enable_idle_tracking = Traits::enable_idle_tracking(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_enable_idle_tracking)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::mojo::interface_control::EnableIdleTrackingDataView, send_validation>(
  in_enable_idle_tracking,
  value_fragment);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null enable_idle_tracking in RunOrClosePipeInput union");
    fragment->data.f_enable_idle_tracking.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
  case ::mojo::interface_control::RunOrClosePipeInputDataView::Tag::kMessageAck: {
    decltype(Traits::message_ack(input))
    in_message_ack = Traits::message_ack(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_message_ack)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::mojo::interface_control::MessageAckDataView, send_validation>(
  in_message_ack,
  value_fragment);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null message_ack in RunOrClosePipeInput union");
    fragment->data.f_message_ack.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
  case ::mojo::interface_control::RunOrClosePipeInputDataView::Tag::kNotifyIdle: {
    decltype(Traits::notify_idle(input))
    in_notify_idle = Traits::notify_idle(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_notify_idle)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::mojo::interface_control::NotifyIdleDataView, send_validation>(
  in_notify_idle,
  value_fragment);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null notify_idle in RunOrClosePipeInput union");
    fragment->data.f_notify_idle.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
}
  }
};

}  // namespace mojo::internal

#endif  // MOJO_PUBLIC_INTERFACES_BINDINGS_INTERFACE_CONTROL_MESSAGES_MOJOM_SEND_VALIDATION_H_