// third_party/blink/public/mojom/ai/ai_proofreader.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 THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_PROOFREADER_MOJOM_SEND_VALIDATION_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_PROOFREADER_MOJOM_SEND_VALIDATION_H_

#include "third_party/blink/public/mojom/ai/ai_proofreader.mojom-shared-internal.h"
#include "third_party/blink/public/mojom/ai/ai_common.mojom-shared.h"
#include "third_party/blink/public/mojom/ai/model_streaming_responder.mojom-shared.h"

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

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

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

      decltype(Traits::correction_explanation_language(input)) in_correction_explanation_language = Traits::correction_explanation_language(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->correction_explanation_language)::BaseType> correction_explanation_language_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::AILanguageCodeDataView, send_validation>(
        in_correction_explanation_language,
        correction_explanation_language_fragment);

      fragment->correction_explanation_language.Set(
          correction_explanation_language_fragment.is_null() ? nullptr : correction_explanation_language_fragment.data());

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

      decltype(Traits::expected_input_languages(input)) in_expected_input_languages = Traits::expected_input_languages(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->expected_input_languages)::BaseType>
          expected_input_languages_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& expected_input_languages_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::blink::mojom::AILanguageCodeDataView>, send_validation>(
        in_expected_input_languages,
        expected_input_languages_fragment,
        &expected_input_languages_validate_params);

      fragment->expected_input_languages.Set(
          expected_input_languages_fragment.is_null() ? nullptr : expected_input_languages_fragment.data());

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

}  // namespace mojo::internal

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_PROOFREADER_MOJOM_SEND_VALIDATION_H_