// components/digital_goods/mojom/digital_goods.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_DIGITAL_GOODS_MOJOM_DIGITAL_GOODS_MOJOM_SEND_VALIDATION_H_
#define COMPONENTS_DIGITAL_GOODS_MOJOM_DIGITAL_GOODS_MOJOM_SEND_VALIDATION_H_

#include "components/digital_goods/mojom/digital_goods.mojom-shared-internal.h"
#include "url/mojom/url.mojom-shared.h"
#include "components/payments/mojom/payment_request_data.mojom-shared.h"

#include "components/digital_goods/mojom/digital_goods.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/has_send_validation_helper.h"

namespace mojo::internal {
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::payments::mojom::BillingResponseCode, MaybeConstUserType>
    : std::false_type {};
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::payments::mojom::ItemType, MaybeConstUserType>
    : std::false_type {};
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::payments::mojom::CreateDigitalGoodsResponseCode, MaybeConstUserType>
    : std::false_type {};

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

      decltype(Traits::item_id(input)) in_item_id = Traits::item_id(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->item_id)::BaseType> item_id_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_item_id,
        item_id_fragment);

      fragment->item_id.Set(
          item_id_fragment.is_null() ? nullptr : item_id_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->item_id.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null item_id in ItemDetails 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());

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

      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 ItemDetails struct");

      decltype(Traits::price(input)) in_price = Traits::price(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->price)::BaseType> price_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::payments::mojom::PaymentCurrencyAmountDataView, send_validation>(
        in_price,
        price_fragment);

      fragment->price.Set(
          price_fragment.is_null() ? nullptr : price_fragment.data());

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

      decltype(Traits::subscription_period(input)) in_subscription_period = Traits::subscription_period(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->subscription_period)::BaseType> subscription_period_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_subscription_period,
        subscription_period_fragment);

      fragment->subscription_period.Set(
          subscription_period_fragment.is_null() ? nullptr : subscription_period_fragment.data());

      decltype(Traits::free_trial_period(input)) in_free_trial_period = Traits::free_trial_period(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->free_trial_period)::BaseType> free_trial_period_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_free_trial_period,
        free_trial_period_fragment);

      fragment->free_trial_period.Set(
          free_trial_period_fragment.is_null() ? nullptr : free_trial_period_fragment.data());

      decltype(Traits::introductory_price(input)) in_introductory_price = Traits::introductory_price(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->introductory_price)::BaseType> introductory_price_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::payments::mojom::PaymentCurrencyAmountDataView, send_validation>(
        in_introductory_price,
        introductory_price_fragment);

      fragment->introductory_price.Set(
          introductory_price_fragment.is_null() ? nullptr : introductory_price_fragment.data());

      decltype(Traits::introductory_price_period(input)) in_introductory_price_period = Traits::introductory_price_period(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->introductory_price_period)::BaseType> introductory_price_period_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_introductory_price_period,
        introductory_price_period_fragment);

      fragment->introductory_price_period.Set(
          introductory_price_period_fragment.is_null() ? nullptr : introductory_price_period_fragment.data());

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

      
      mojo::internal::Serialize<::payments::mojom::ItemType>(
        Traits::type(input),
        &fragment->type);

      decltype(Traits::icon_urls(input)) in_icon_urls = Traits::icon_urls(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->icon_urls)::BaseType>
          icon_urls_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& icon_urls_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::url::mojom::UrlDataView>, send_validation>(
        in_icon_urls,
        icon_urls_fragment,
        &icon_urls_validate_params);

      fragment->icon_urls.Set(
          icon_urls_fragment.is_null() ? nullptr : icon_urls_fragment.data());
  }
};

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

      decltype(Traits::item_id(input)) in_item_id = Traits::item_id(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->item_id)::BaseType> item_id_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_item_id,
        item_id_fragment);

      fragment->item_id.Set(
          item_id_fragment.is_null() ? nullptr : item_id_fragment.data());

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

      decltype(Traits::purchase_token(input)) in_purchase_token = Traits::purchase_token(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->purchase_token)::BaseType> purchase_token_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_purchase_token,
        purchase_token_fragment);

      fragment->purchase_token.Set(
          purchase_token_fragment.is_null() ? nullptr : purchase_token_fragment.data());

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

}  // namespace mojo::internal

#endif  // COMPONENTS_DIGITAL_GOODS_MOJOM_DIGITAL_GOODS_MOJOM_SEND_VALIDATION_H_