// chrome/common/readaloud/read_aloud.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 CHROME_COMMON_READALOUD_READ_ALOUD_MOJOM_SEND_VALIDATION_H_
#define CHROME_COMMON_READALOUD_READ_ALOUD_MOJOM_SEND_VALIDATION_H_

#include "chrome/common/readaloud/read_aloud.mojom-shared-internal.h"
#include "media/mojo/mojom/audio_data_pipe.mojom-shared.h"
#include "media/mojo/mojom/audio_output_stream.mojom-shared.h"
#include "media/mojo/mojom/audio_parameters.mojom-shared.h"
#include "mojo/public/mojom/base/big_buffer.mojom-shared.h"
#include "mojo/public/mojom/base/string16.mojom-shared.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"
#include "mojo/public/mojom/base/work_in_progress.mojom-shared.h"
#include "sandbox/policy/mojom/sandbox.mojom-shared.h"

#include "chrome/common/readaloud/read_aloud.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"
#include "mojo/public/cpp/bindings/lib/has_send_validation_helper.h"

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

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

      fragment->segment_index = Traits::segment_index(input);

      decltype(Traits::text(input)) in_text = Traits::text(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->text)::BaseType> text_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::mojo_base::mojom::String16DataView, send_validation>(
        in_text,
        text_fragment);

      fragment->text.Set(
          text_fragment.is_null() ? nullptr : text_fragment.data());

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

}  // namespace mojo::internal

#endif  // CHROME_COMMON_READALOUD_READ_ALOUD_MOJOM_SEND_VALIDATION_H_