// ui/display/mojom/screen_info.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 UI_DISPLAY_MOJOM_SCREEN_INFO_MOJOM_SHARED_H_
#define UI_DISPLAY_MOJOM_SCREEN_INFO_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 "ui/display/mojom/screen_info.mojom-shared-internal.h"
#include "ui/display/mojom/screen_orientation.mojom-shared.h"
#include "ui/gfx/geometry/mojom/geometry.mojom-shared.h"
#include "ui/gfx/mojom/display_color_spaces.mojom-shared.h"




#include "ui/display/mojom/screen_info.mojom-data-view.h"  // IWYU pragma: export




namespace std {

}  // namespace std

namespace mojo {


namespace internal {

template <typename MaybeConstUserType>
struct Serializer<::display::mojom::ScreenInfoDataView, MaybeConstUserType> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::display::mojom::ScreenInfoDataView, UserType>;

  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::display::mojom::internal::ScreenInfo_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

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

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

    decltype(Traits::display_color_spaces(input)) in_display_color_spaces = Traits::display_color_spaces(input);
    mojo::internal::MessageFragment<
        typename decltype(fragment->display_color_spaces)::BaseType> display_color_spaces_fragment(
            fragment.message());
    
    mojo::internal::Serialize<::gfx::mojom::DisplayColorSpacesDataView>(
      in_display_color_spaces,
      display_color_spaces_fragment);

    fragment->display_color_spaces.Set(
        display_color_spaces_fragment.is_null() ? nullptr : display_color_spaces_fragment.data());

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

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

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

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

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

    decltype(Traits::rect(input)) in_rect = Traits::rect(input);
    mojo::internal::MessageFragment<
        typename decltype(fragment->rect)::BaseType> rect_fragment(
            fragment.message());
    
    mojo::internal::Serialize<::gfx::mojom::RectDataView>(
      in_rect,
      rect_fragment);

    fragment->rect.Set(
        rect_fragment.is_null() ? nullptr : rect_fragment.data());

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

    decltype(Traits::available_rect(input)) in_available_rect = Traits::available_rect(input);
    mojo::internal::MessageFragment<
        typename decltype(fragment->available_rect)::BaseType> available_rect_fragment(
            fragment.message());
    
    mojo::internal::Serialize<::gfx::mojom::RectDataView>(
      in_available_rect,
      available_rect_fragment);

    fragment->available_rect.Set(
        available_rect_fragment.is_null() ? nullptr : available_rect_fragment.data());

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

    
    mojo::internal::Serialize<::display::mojom::ScreenOrientation>(
      Traits::orientation_type(input),
      &fragment->orientation_type);

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

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

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

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

    decltype(Traits::label(input)) in_label = Traits::label(input);
    mojo::internal::MessageFragment<
        typename decltype(fragment->label)::BaseType> label_fragment(
            fragment.message());
    
    mojo::internal::Serialize<mojo::StringDataView>(
      in_label,
      label_fragment);

    fragment->label.Set(
        label_fragment.is_null() ? nullptr : label_fragment.data());

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

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

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

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

    ::display::mojom::ScreenInfoDataView data_view(input, message);
    return CallTraitsRead<Traits>(data_view, output);
  }
};

}  // namespace internal

}  // namespace mojo


namespace display::mojom {

inline void ScreenInfoDataView::GetDisplayColorSpacesDataView(
    ::gfx::mojom::DisplayColorSpacesDataView* output) {
  auto pointer = data_->display_color_spaces.Get();
  *output = ::gfx::mojom::DisplayColorSpacesDataView(pointer, message_);
}
inline void ScreenInfoDataView::GetRectDataView(
    ::gfx::mojom::RectDataView* output) {
  auto pointer = data_->rect.Get();
  *output = ::gfx::mojom::RectDataView(pointer, message_);
}
inline void ScreenInfoDataView::GetAvailableRectDataView(
    ::gfx::mojom::RectDataView* output) {
  auto pointer = data_->available_rect.Get();
  *output = ::gfx::mojom::RectDataView(pointer, message_);
}
inline void ScreenInfoDataView::GetLabelDataView(
    mojo::StringDataView* output) {
  auto pointer = data_->label.Get();
  *output = mojo::StringDataView(pointer, message_);
}



}  // display::mojom

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

#endif  // UI_DISPLAY_MOJOM_SCREEN_INFO_MOJOM_SHARED_H_