// third_party/blink/public/mojom/ai/ai_semantic_embedder.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_AI_AI_SEMANTIC_EMBEDDER_MOJOM_DATA_VIEW_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_SEMANTIC_EMBEDDER_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/ai/ai_semantic_embedder.mojom-shared-internal.h"
#include "third_party/blink/public/mojom/ai/ai_common.mojom-shared.h"


namespace blink::mojom {
class AISemanticEmbedderEmbedOptionsDataView;

class ContentEmbeddingDataView;

class SemanticEmbedderResultDataView;



}  // blink::mojom


namespace mojo {
namespace internal {

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

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

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

}  // namespace internal
}  // namespace mojo


namespace blink::mojom {


enum class AISemanticEmbedderTaskType : int32_t {
  
  kSemanticSimilarity = 0,
  
  kClustering = 1,
  
  kClassification = 2,
  
  kRetrievalQuery = 3,
  
  kRetrievalDocument = 4,
  kMinValue = 0,
  kMaxValue = 4,
};

COMPONENT_EXPORT(MOJOM_SHARED_BLINK_COMMON_EXPORT) std::ostream& operator<<(std::ostream& os, AISemanticEmbedderTaskType value);
inline bool IsKnownEnumValue(AISemanticEmbedderTaskType value) {
  return internal::AISemanticEmbedderTaskType_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(AISemanticEmbedderTaskType) {
  return true;
}
// Interface base classes. They are used for type safety check.
class AISemanticEmbedderInterfaceBase {};

using AISemanticEmbedderPtrDataView =
    mojo::InterfacePtrDataView<AISemanticEmbedderInterfaceBase>;
using AISemanticEmbedderRequestDataView =
    mojo::InterfaceRequestDataView<AISemanticEmbedderInterfaceBase>;
using AISemanticEmbedderAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<AISemanticEmbedderInterfaceBase>;
using AISemanticEmbedderAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<AISemanticEmbedderInterfaceBase>;


class AISemanticEmbedderEmbedOptionsDataView {
 public:
  AISemanticEmbedderEmbedOptionsDataView() = default;

  AISemanticEmbedderEmbedOptionsDataView(
      internal::AISemanticEmbedderEmbedOptions_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  template <typename UserType>
  [[nodiscard]] bool ReadTaskType(UserType* output) const {
    if (!data_->task_type_$flag) {
      *output = std::nullopt;
      return true;
    }

    return mojo::internal::Deserialize<::blink::mojom::AISemanticEmbedderTaskType>(
        data_->task_type_$value, &output->emplace());
  }
  std::optional<AISemanticEmbedderTaskType> task_type() const {
    if (!data_->task_type_$flag) {
      return std::nullopt;
    }
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::blink::mojom::AISemanticEmbedderTaskType>(data_->task_type_$value));
  }
 private:
  internal::AISemanticEmbedderEmbedOptions_Data* data_ = nullptr;
};


class ContentEmbeddingDataView {
 public:
  ContentEmbeddingDataView() = default;

  ContentEmbeddingDataView(
      internal::ContentEmbedding_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

  template <typename UserType>
  [[nodiscard]] bool ReadValues(UserType* output) {
    
    auto* pointer = data_->values.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<float>>(
        pointer, output, message_);
  }
 private:
  internal::ContentEmbedding_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


class SemanticEmbedderResultDataView {
 public:
  SemanticEmbedderResultDataView() = default;

  SemanticEmbedderResultDataView(
      internal::SemanticEmbedderResult_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

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


}  // blink::mojom

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_AI_AI_SEMANTIC_EMBEDDER_MOJOM_DATA_VIEW_H_