// third_party/blink/public/mojom/content_extraction/script_tools.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_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_SEND_VALIDATION_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_SEND_VALIDATION_H_

#include "third_party/blink/public/mojom/content_extraction/script_tools.mojom-shared-internal.h"
#include "third_party/blink/public/mojom/tokens/tokens.mojom-shared.h"
#include "url/mojom/origin.mojom-shared.h"
#include "mojo/public/mojom/base/unguessable_token.mojom-shared.h"

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

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

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

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

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

      decltype(Traits::name(input)) in_name = Traits::name(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->name)::BaseType> name_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_name,
        name_fragment);

      fragment->name.Set(
          name_fragment.is_null() ? nullptr : name_fragment.data());

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

      decltype(Traits::title(input)) in_title = Traits::title(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->title)::BaseType> title_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_title,
        title_fragment);

      fragment->title.Set(
          title_fragment.is_null() ? nullptr : title_fragment.data());

      decltype(Traits::description(input)) in_description = Traits::description(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->description)::BaseType> description_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_description,
        description_fragment);

      fragment->description.Set(
          description_fragment.is_null() ? nullptr : description_fragment.data());

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

      decltype(Traits::input_schema(input)) in_input_schema = Traits::input_schema(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->input_schema)::BaseType> input_schema_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_input_schema,
        input_schema_fragment);

      fragment->input_schema.Set(
          input_schema_fragment.is_null() ? nullptr : input_schema_fragment.data());

      decltype(Traits::annotations(input)) in_annotations = Traits::annotations(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->annotations)::BaseType> annotations_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::ScriptToolAnnotationsDataView, send_validation>(
        in_annotations,
        annotations_fragment);

      fragment->annotations.Set(
          annotations_fragment.is_null() ? nullptr : annotations_fragment.data());

      decltype(Traits::exposed_origins(input)) in_exposed_origins = Traits::exposed_origins(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->exposed_origins)::BaseType>
          exposed_origins_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& exposed_origins_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::url::mojom::OriginDataView>, send_validation>(
        in_exposed_origins,
        exposed_origins_fragment,
        &exposed_origins_validate_params);

      fragment->exposed_origins.Set(
          exposed_origins_fragment.is_null() ? nullptr : exposed_origins_fragment.data());

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

      decltype(Traits::tool_owner_frame_token(input)) in_tool_owner_frame_token = Traits::tool_owner_frame_token(input);
      mojo::internal::MessageFragment<decltype(fragment->tool_owner_frame_token)>
          tool_owner_frame_token_fragment(fragment.message());
      tool_owner_frame_token_fragment.Claim(&fragment->tool_owner_frame_token);
      
      mojo::internal::Serialize<::blink::mojom::FrameTokenDataView, send_validation>(
        in_tool_owner_frame_token,
        tool_owner_frame_token_fragment,
        true);

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

      decltype(Traits::origin(input)) in_origin = Traits::origin(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->origin)::BaseType> origin_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::url::mojom::OriginDataView, send_validation>(
        in_origin,
        origin_fragment);

      fragment->origin.Set(
          origin_fragment.is_null() ? nullptr : origin_fragment.data());

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

}  // namespace mojo::internal

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_SEND_VALIDATION_H_