// third_party/blink/public/mojom/content_extraction/script_tools.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_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_DATA_VIEW_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_CONTENT_EXTRACTION_SCRIPT_TOOLS_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/content_extraction/script_tools.mojom-shared-internal.h"
#include "third_party/blink/public/mojom/tokens/tokens.mojom-shared.h"
#include "url/mojom/origin.mojom-shared.h"
#include "mojo/public/mojom/base/unguessable_token.mojom-shared.h"


namespace blink::mojom {
class ScriptToolAnnotationsDataView;

class ScriptToolDataView;



}  // blink::mojom


namespace mojo {
namespace internal {

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

template <>
struct MojomTypeTraits<::blink::mojom::ScriptToolDataView> {
  using Data = ::blink::mojom::internal::ScriptTool_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 ScriptToolHostInterfaceBase {};

using ScriptToolHostPtrDataView =
    mojo::InterfacePtrDataView<ScriptToolHostInterfaceBase>;
using ScriptToolHostRequestDataView =
    mojo::InterfaceRequestDataView<ScriptToolHostInterfaceBase>;
using ScriptToolHostAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ScriptToolHostInterfaceBase>;
using ScriptToolHostAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ScriptToolHostInterfaceBase>;
class ModelContextHostInterfaceBase {};

using ModelContextHostPtrDataView =
    mojo::InterfacePtrDataView<ModelContextHostInterfaceBase>;
using ModelContextHostRequestDataView =
    mojo::InterfaceRequestDataView<ModelContextHostInterfaceBase>;
using ModelContextHostAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ModelContextHostInterfaceBase>;
using ModelContextHostAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ModelContextHostInterfaceBase>;
class ModelContextInterfaceBase {};

using ModelContextPtrDataView =
    mojo::InterfacePtrDataView<ModelContextInterfaceBase>;
using ModelContextRequestDataView =
    mojo::InterfaceRequestDataView<ModelContextInterfaceBase>;
using ModelContextAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<ModelContextInterfaceBase>;
using ModelContextAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<ModelContextInterfaceBase>;


class ScriptToolAnnotationsDataView {
 public:
  ScriptToolAnnotationsDataView() = default;

  ScriptToolAnnotationsDataView(
      internal::ScriptToolAnnotations_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  bool read_only() const {
    return data_->read_only;
  }
  bool untrusted_content() const {
    return data_->untrusted_content;
  }
  bool consequential() const {
    return data_->consequential;
  }
 private:
  internal::ScriptToolAnnotations_Data* data_ = nullptr;
};


class ScriptToolDataView {
 public:
  ScriptToolDataView() = default;

  ScriptToolDataView(
      internal::ScriptTool_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 GetTitleDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadTitle(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::StringDataView, UserType>(),
    "Attempting to read the optional `title` 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 `MaybeReadTitle` instead "
    "of `ReadTitle if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->title.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetDescriptionDataView(
      mojo::StringDataView* output);

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

  template <typename UserType>
  [[nodiscard]] bool ReadInputSchema(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        mojo::StringDataView, UserType>(),
    "Attempting to read the optional `input_schema` 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 `MaybeReadInputSchema` instead "
    "of `ReadInputSchema if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->input_schema.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetAnnotationsDataView(
      ScriptToolAnnotationsDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadAnnotations(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::blink::mojom::ScriptToolAnnotationsDataView, UserType>(),
    "Attempting to read the optional `annotations` 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 `MaybeReadAnnotations` instead "
    "of `ReadAnnotations if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->annotations.Get();
    return mojo::internal::Deserialize<::blink::mojom::ScriptToolAnnotationsDataView>(
        pointer, output, message_);
  }
  inline void GetExposedOriginsDataView(
      mojo::ArrayDataView<::url::mojom::OriginDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadExposedOrigins(UserType* output) {
    
    auto* pointer = data_->exposed_origins.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::url::mojom::OriginDataView>>(
        pointer, output, message_);
  }
  inline void GetToolOwnerFrameTokenDataView(
      ::blink::mojom::FrameTokenDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadToolOwnerFrameToken(UserType* output) {
    
    auto* pointer = !data_->tool_owner_frame_token.is_null() ? &data_->tool_owner_frame_token : nullptr;
    return mojo::internal::Deserialize<::blink::mojom::FrameTokenDataView>(
        pointer, output, message_);
  }
  inline void GetOriginDataView(
      ::url::mojom::OriginDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadOrigin(UserType* output) {
    
    auto* pointer = data_->origin.Get();
    return mojo::internal::Deserialize<::url::mojom::OriginDataView>(
        pointer, output, message_);
  }
 private:
  internal::ScriptTool_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // blink::mojom

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_CONTENT_EXTRACTION_SCRIPT_TOOLS_MOJOM_DATA_VIEW_H_