// components/commerce/core/mojom/shared.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 COMPONENTS_COMMERCE_CORE_MOJOM_SHARED_MOJOM_SEND_VALIDATION_H_
#define COMPONENTS_COMMERCE_CORE_MOJOM_SHARED_MOJOM_SEND_VALIDATION_H_

#include "components/commerce/core/mojom/shared.mojom-shared-internal.h"
#include "url/mojom/url.mojom-shared.h"

#include "components/commerce/core/mojom/shared.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<::commerce::shared::mojom::ProductInfoDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::commerce::shared::mojom::ProductInfoDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::commerce::shared::mojom::internal::ProductInfo_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      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());

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

      decltype(Traits::cluster_title(input)) in_cluster_title = Traits::cluster_title(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->cluster_title)::BaseType> cluster_title_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_cluster_title,
        cluster_title_fragment);

      fragment->cluster_title.Set(
          cluster_title_fragment.is_null() ? nullptr : cluster_title_fragment.data());

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

      decltype(Traits::domain(input)) in_domain = Traits::domain(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->domain)::BaseType> domain_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_domain,
        domain_fragment);

      fragment->domain.Set(
          domain_fragment.is_null() ? nullptr : domain_fragment.data());

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

      decltype(Traits::image_url(input)) in_image_url = Traits::image_url(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->image_url)::BaseType> image_url_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::url::mojom::UrlDataView, send_validation>(
        in_image_url,
        image_url_fragment);

      fragment->image_url.Set(
          image_url_fragment.is_null() ? nullptr : image_url_fragment.data());

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

      decltype(Traits::product_url(input)) in_product_url = Traits::product_url(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->product_url)::BaseType> product_url_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::url::mojom::UrlDataView, send_validation>(
        in_product_url,
        product_url_fragment);

      fragment->product_url.Set(
          product_url_fragment.is_null() ? nullptr : product_url_fragment.data());

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

      decltype(Traits::current_price(input)) in_current_price = Traits::current_price(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->current_price)::BaseType> current_price_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_current_price,
        current_price_fragment);

      fragment->current_price.Set(
          current_price_fragment.is_null() ? nullptr : current_price_fragment.data());

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

      decltype(Traits::previous_price(input)) in_previous_price = Traits::previous_price(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->previous_price)::BaseType> previous_price_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_previous_price,
        previous_price_fragment);

      fragment->previous_price.Set(
          previous_price_fragment.is_null() ? nullptr : previous_price_fragment.data());

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

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

      decltype(Traits::category_labels(input)) in_category_labels = Traits::category_labels(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->category_labels)::BaseType>
          category_labels_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& category_labels_validate_params =
          mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<mojo::StringDataView>, send_validation>(
        in_category_labels,
        category_labels_fragment,
        &category_labels_validate_params);

      fragment->category_labels.Set(
          category_labels_fragment.is_null() ? nullptr : category_labels_fragment.data());

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

      decltype(Traits::price_summary(input)) in_price_summary = Traits::price_summary(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->price_summary)::BaseType> price_summary_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_price_summary,
        price_summary_fragment);

      fragment->price_summary.Set(
          price_summary_fragment.is_null() ? nullptr : price_summary_fragment.data());

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

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

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

      decltype(Traits::info(input)) in_info = Traits::info(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->info)::BaseType> info_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::commerce::shared::mojom::ProductInfoDataView, send_validation>(
        in_info,
        info_fragment);

      fragment->info.Set(
          info_fragment.is_null() ? nullptr : info_fragment.data());

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

}  // namespace mojo::internal

#endif  // COMPONENTS_COMMERCE_CORE_MOJOM_SHARED_MOJOM_SEND_VALIDATION_H_