// third_party/blink/public/mojom/frame/reporting_observer.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 THIRD_PARTY_BLINK_PUBLIC_MOJOM_FRAME_REPORTING_OBSERVER_MOJOM_DATA_VIEW_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_FRAME_REPORTING_OBSERVER_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 "third_party/blink/public/mojom/frame/reporting_observer.mojom-shared-internal.h"
#include "url/mojom/url.mojom-shared.h"


namespace blink::mojom {
class ReportBodyElementDataView;

class ReportBodyDataView;

class ReportDataView;



}  // blink::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::blink::mojom::ReportBodyElementDataView> {
  using Data = ::blink::mojom::internal::ReportBodyElement_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::blink::mojom::ReportBodyDataView> {
  using Data = ::blink::mojom::internal::ReportBody_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::blink::mojom::ReportDataView> {
  using Data = ::blink::mojom::internal::Report_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace blink::mojom {
// Interface base classes. They are used for type safety check.
class ReportingObserverInterfaceBase {};

using ReportingObserverPtrDataView =
    mojo::InterfacePtrDataView<ReportingObserverInterfaceBase>;
using ReportingObserverRequestDataView =
    mojo::InterfaceRequestDataView<ReportingObserverInterfaceBase>;
using ReportingObserverAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ReportingObserverInterfaceBase>;
using ReportingObserverAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ReportingObserverInterfaceBase>;


class ReportBodyElementDataView {
 public:
  ReportBodyElementDataView() = default;

  ReportBodyElementDataView(
      internal::ReportBodyElement_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetNameDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadName(UserType* output) {
    
    auto* pointer = data_->name.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetValueDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadValue(UserType* output) {
    
    auto* pointer = data_->value.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
 private:
  internal::ReportBodyElement_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class ReportBodyDataView {
 public:
  ReportBodyDataView() = default;

  ReportBodyDataView(
      internal::ReportBody_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetBodyDataView(
      mojo::ArrayDataView<ReportBodyElementDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadBody(UserType* output) {
    
    auto* pointer = data_->body.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::blink::mojom::ReportBodyElementDataView>>(
        pointer, output, message_);
  }
 private:
  internal::ReportBody_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class ReportDataView {
 public:
  ReportDataView() = default;

  ReportDataView(
      internal::Report_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetTypeDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadType(UserType* output) {
    
    auto* pointer = data_->type.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetUrlDataView(
      ::url::mojom::UrlDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadUrl(UserType* output) {
    
    auto* pointer = data_->url.Get();
    return mojo::internal::Deserialize<::url::mojom::UrlDataView>(
        pointer, output, message_);
  }
  inline void GetBodyDataView(
      ReportBodyDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadBody(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::blink::mojom::ReportBodyDataView, UserType>(),
    "Attempting to read the optional `body` 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 `MaybeReadBody` instead "
    "of `ReadBody if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->body.Get();
    return mojo::internal::Deserialize<::blink::mojom::ReportBodyDataView>(
        pointer, output, message_);
  }
 private:
  internal::Report_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // blink::mojom

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_FRAME_REPORTING_OBSERVER_MOJOM_DATA_VIEW_H_