// third_party/blink/public/mojom/buckets/bucket_manager_host.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_BUCKETS_BUCKET_MANAGER_HOST_MOJOM_DATA_VIEW_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_BUCKETS_BUCKET_MANAGER_HOST_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/buckets/bucket_manager_host.mojom-shared-internal.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-shared.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_directory_handle.mojom-shared.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_error.mojom-shared.h"
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom-shared.h"
#include "third_party/blink/public/mojom/locks/lock_manager.mojom-shared.h"
#include "third_party/blink/public/mojom/quota/quota_types.mojom-shared.h"


namespace blink::mojom {
class BucketPoliciesDataView;



}  // blink::mojom


namespace mojo {
namespace internal {

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

}  // namespace internal
}  // namespace mojo


namespace blink::mojom {


enum class BucketError : int32_t {
  
  kUnknown = 0,
  
  kQuotaExceeded = 1,
  
  kInvalidExpiration = 2,
  kMinValue = 0,
  kMaxValue = 2,
};

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

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

using BucketHostPtrDataView =
    mojo::InterfacePtrDataView<BucketHostInterfaceBase>;
using BucketHostRequestDataView =
    mojo::InterfaceRequestDataView<BucketHostInterfaceBase>;
using BucketHostAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<BucketHostInterfaceBase>;
using BucketHostAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<BucketHostInterfaceBase>;
class BucketManagerHostInterfaceBase {};

using BucketManagerHostPtrDataView =
    mojo::InterfacePtrDataView<BucketManagerHostInterfaceBase>;
using BucketManagerHostRequestDataView =
    mojo::InterfaceRequestDataView<BucketManagerHostInterfaceBase>;
using BucketManagerHostAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<BucketManagerHostInterfaceBase>;
using BucketManagerHostAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<BucketManagerHostInterfaceBase>;


class BucketPoliciesDataView {
 public:
  BucketPoliciesDataView() = default;

  BucketPoliciesDataView(
      internal::BucketPolicies_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  bool persisted() const {
    return data_->persisted;
  }
  bool has_persisted() const {
    return data_->has_persisted;
  }
  template <typename UserType>
  [[nodiscard]] bool ReadDurability(UserType* output) const {
    auto data_value = data_->durability;
    return mojo::internal::Deserialize<::blink::mojom::BucketDurability>(
        data_value, output);
  }
  ::blink::mojom::BucketDurability durability() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::blink::mojom::BucketDurability>(data_->durability));
  }
  bool has_durability() const {
    return data_->has_durability;
  }
  int64_t quota() const {
    return data_->quota;
  }
  bool has_quota() const {
    return data_->has_quota;
  }
  inline void GetExpiresDataView(
      ::mojo_base::mojom::TimeDataView* output);

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


}  // blink::mojom

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_BUCKETS_BUCKET_MANAGER_HOST_MOJOM_DATA_VIEW_H_