// chrome/common/trusted_vault_encryption_keys_extension.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 CHROME_COMMON_TRUSTED_VAULT_ENCRYPTION_KEYS_EXTENSION_MOJOM_DATA_VIEW_H_
#define CHROME_COMMON_TRUSTED_VAULT_ENCRYPTION_KEYS_EXTENSION_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 "chrome/common/trusted_vault_encryption_keys_extension.mojom-shared-internal.h"


namespace chrome::mojom {
class TrustedVaultKeyDataView;



}  // chrome::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::chrome::mojom::TrustedVaultKeyDataView> {
  using Data = ::chrome::mojom::internal::TrustedVaultKey_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


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

using TrustedVaultEncryptionKeysExtensionPtrDataView =
    mojo::InterfacePtrDataView<TrustedVaultEncryptionKeysExtensionInterfaceBase>;
using TrustedVaultEncryptionKeysExtensionRequestDataView =
    mojo::InterfaceRequestDataView<TrustedVaultEncryptionKeysExtensionInterfaceBase>;
using TrustedVaultEncryptionKeysExtensionAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<TrustedVaultEncryptionKeysExtensionInterfaceBase>;
using TrustedVaultEncryptionKeysExtensionAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<TrustedVaultEncryptionKeysExtensionInterfaceBase>;


class TrustedVaultKeyDataView {
 public:
  TrustedVaultKeyDataView() = default;

  TrustedVaultKeyDataView(
      internal::TrustedVaultKey_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  int32_t version() const {
    return data_->version;
  }
  inline void GetBytesDataView(
      mojo::ArrayDataView<uint8_t>* output);

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


}  // chrome::mojom

#endif  // CHROME_COMMON_TRUSTED_VAULT_ENCRYPTION_KEYS_EXTENSION_MOJOM_DATA_VIEW_H_