// services/viz/public/mojom/compositing/tracked_element_rects.mojom-data-view.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.

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef SERVICES_VIZ_PUBLIC_MOJOM_COMPOSITING_TRACKED_ELEMENT_RECTS_MOJOM_DATA_VIEW_H_
#define SERVICES_VIZ_PUBLIC_MOJOM_COMPOSITING_TRACKED_ELEMENT_RECTS_MOJOM_DATA_VIEW_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/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "services/viz/public/mojom/compositing/tracked_element_rects.mojom-shared-internal.h"
#include "mojo/public/mojom/base/token.mojom-shared.h"
#include "third_party/blink/public/mojom/tokens/tokens.mojom-shared.h"
#include "ui/gfx/geometry/mojom/geometry.mojom-shared.h"


namespace viz::mojom {
class TrackedElementRectDataView;

class TrackedElementRectsDataView;



}  // viz::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::viz::mojom::TrackedElementRectDataView> {
  using Data = ::viz::mojom::internal::TrackedElementRect_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::viz::mojom::TrackedElementRectsDataView> {
  using Data = ::viz::mojom::internal::TrackedElementRects_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace viz::mojom {


class TrackedElementRectDataView {
 public:
  TrackedElementRectDataView() = default;

  TrackedElementRectDataView(
      internal::TrackedElementRect_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetTrackedElementIdDataView(
      ::mojo_base::mojom::TokenDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadTrackedElementId(UserType* output) {
    
    auto* pointer = data_->tracked_element_id.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TokenDataView>(
        pointer, output, message_);
  }
  inline void GetVisibleBoundsDataView(
      ::gfx::mojom::RectDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadVisibleBounds(UserType* output) {
    
    auto* pointer = data_->visible_bounds.Get();
    return mojo::internal::Deserialize<::gfx::mojom::RectDataView>(
        pointer, output, message_);
  }
  bool should_add_to_compositor_frame_metadata() const {
    return data_->should_add_to_compositor_frame_metadata;
  }
  bool should_exclude_fixed_and_sticky_occlusions() const {
    return data_->should_exclude_fixed_and_sticky_occlusions;
  }
  inline void GetFrameTokenDataView(
      ::blink::mojom::FrameTokenDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadFrameToken(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::blink::mojom::FrameTokenDataView, UserType>(),
    "Attempting to read the optional `frame_token` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadFrameToken` instead "
    "of `ReadFrameToken if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = !data_->frame_token.is_null() ? &data_->frame_token : nullptr;
    return mojo::internal::Deserialize<::blink::mojom::FrameTokenDataView>(
        pointer, output, message_);
  }
  inline void GetParentFrameTokenDataView(
      ::blink::mojom::LocalFrameTokenDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadParentFrameToken(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::blink::mojom::LocalFrameTokenDataView, UserType>(),
    "Attempting to read the optional `parent_frame_token` field into a type which "
    "cannot represent a null value. Either wrap the destination object "
    "with std::optional, ensure that any corresponding "
    "{Struct/Union/Array/String}Traits define the necessary IsNull and "
    "SetToNull methods, or use `MaybeReadParentFrameToken` instead "
    "of `ReadParentFrameToken if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->parent_frame_token.Get();
    return mojo::internal::Deserialize<::blink::mojom::LocalFrameTokenDataView>(
        pointer, output, message_);
  }
 private:
  internal::TrackedElementRect_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class TrackedElementRectsDataView {
 public:
  TrackedElementRectsDataView() = default;

  TrackedElementRectsDataView(
      internal::TrackedElementRects_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetElementDataDataView(
      mojo::MapDataView<int32_t, mojo::ArrayDataView<TrackedElementRectDataView>>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadElementData(UserType* output) {
    
    auto* pointer = data_->element_data.Get();
    return mojo::internal::Deserialize<mojo::MapDataView<int32_t, mojo::ArrayDataView<::viz::mojom::TrackedElementRectDataView>>>(
        pointer, output, message_);
  }
 private:
  internal::TrackedElementRects_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // viz::mojom

#endif  // SERVICES_VIZ_PUBLIC_MOJOM_COMPOSITING_TRACKED_ELEMENT_RECTS_MOJOM_DATA_VIEW_H_