// components/commerce/core/mojom/shared.mojom-shared.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2016 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_SHARED_H_
#define COMPONENTS_COMMERCE_CORE_MOJOM_SHARED_MOJOM_SHARED_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/map_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/system/message_pipe.h"

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.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"  // IWYU pragma: export




namespace std {

}  // namespace std

namespace mojo {


namespace internal {

template <typename MaybeConstUserType>
struct Serializer<::commerce::shared::mojom::ProductInfoDataView, MaybeConstUserType> {
  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>(
      in_title,
      title_fragment);

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

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(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>(
      in_cluster_title,
      cluster_title_fragment);

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

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(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>(
      in_domain,
      domain_fragment);

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

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(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>(
      in_image_url,
      image_url_fragment);

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

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(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>(
      in_product_url,
      product_url_fragment);

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

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(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>(
      in_current_price,
      current_price_fragment);

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

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(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>(
      in_previous_price,
      previous_price_fragment);

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

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(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>>(
      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(
      mojo::internal::SendValidation::kDefault,
      !(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>(
      in_price_summary,
      price_summary_fragment);

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

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

  static bool Deserialize(::commerce::shared::mojom::internal::ProductInfo_Data* input,
                          UserType* output,
                          Message* message) {
    if (!input)
      return CallSetToNullIfExists<Traits>(output);

    ::commerce::shared::mojom::ProductInfoDataView data_view(input, message);
    return CallTraitsRead<Traits>(data_view, output);
  }
};

}  // namespace internal


namespace internal {

template <typename MaybeConstUserType>
struct Serializer<::commerce::shared::mojom::BookmarkProductInfoDataView, MaybeConstUserType> {
  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>(
      in_info,
      info_fragment);

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

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

  static bool Deserialize(::commerce::shared::mojom::internal::BookmarkProductInfo_Data* input,
                          UserType* output,
                          Message* message) {
    if (!input)
      return CallSetToNullIfExists<Traits>(output);

    ::commerce::shared::mojom::BookmarkProductInfoDataView data_view(input, message);
    return CallTraitsRead<Traits>(data_view, output);
  }
};

}  // namespace internal

}  // namespace mojo


namespace commerce::shared::mojom {

inline void ProductInfoDataView::GetTitleDataView(
    mojo::StringDataView* output) {
  auto pointer = data_->title.Get();
  *output = mojo::StringDataView(pointer, message_);
}
inline void ProductInfoDataView::GetClusterTitleDataView(
    mojo::StringDataView* output) {
  auto pointer = data_->cluster_title.Get();
  *output = mojo::StringDataView(pointer, message_);
}
inline void ProductInfoDataView::GetDomainDataView(
    mojo::StringDataView* output) {
  auto pointer = data_->domain.Get();
  *output = mojo::StringDataView(pointer, message_);
}
inline void ProductInfoDataView::GetImageUrlDataView(
    ::url::mojom::UrlDataView* output) {
  auto pointer = data_->image_url.Get();
  *output = ::url::mojom::UrlDataView(pointer, message_);
}
inline void ProductInfoDataView::GetProductUrlDataView(
    ::url::mojom::UrlDataView* output) {
  auto pointer = data_->product_url.Get();
  *output = ::url::mojom::UrlDataView(pointer, message_);
}
inline void ProductInfoDataView::GetCurrentPriceDataView(
    mojo::StringDataView* output) {
  auto pointer = data_->current_price.Get();
  *output = mojo::StringDataView(pointer, message_);
}
inline void ProductInfoDataView::GetPreviousPriceDataView(
    mojo::StringDataView* output) {
  auto pointer = data_->previous_price.Get();
  *output = mojo::StringDataView(pointer, message_);
}
inline void ProductInfoDataView::GetCategoryLabelsDataView(
    mojo::ArrayDataView<mojo::StringDataView>* output) {
  auto pointer = data_->category_labels.Get();
  *output = mojo::ArrayDataView<mojo::StringDataView>(pointer, message_);
}
inline void ProductInfoDataView::GetPriceSummaryDataView(
    mojo::StringDataView* output) {
  auto pointer = data_->price_summary.Get();
  *output = mojo::StringDataView(pointer, message_);
}


inline void BookmarkProductInfoDataView::GetInfoDataView(
    ProductInfoDataView* output) {
  auto pointer = data_->info.Get();
  *output = ProductInfoDataView(pointer, message_);
}



}  // commerce::shared::mojom

// Declare TraceFormatTraits for enums, which should be defined in ::perfetto
// namespace.

#endif  // COMPONENTS_COMMERCE_CORE_MOJOM_SHARED_MOJOM_SHARED_H_