// third_party/blink/public/mojom/idle/idle_manager.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_IDLE_IDLE_MANAGER_MOJOM_DATA_VIEW_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_IDLE_IDLE_MANAGER_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/idle/idle_manager.mojom-shared-internal.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"


namespace blink::mojom {
class IdleStateDataView;



}  // blink::mojom


namespace mojo {
namespace internal {

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

}  // namespace internal
}  // namespace mojo


namespace blink::mojom {


enum class IdleManagerError : int32_t {
  
  kSuccess = 0,
  
  kPermissionDisabled = 1,
  kMinValue = 0,
  kMaxValue = 1,
};

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

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

using IdleMonitorPtrDataView =
    mojo::InterfacePtrDataView<IdleMonitorInterfaceBase>;
using IdleMonitorRequestDataView =
    mojo::InterfaceRequestDataView<IdleMonitorInterfaceBase>;
using IdleMonitorAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<IdleMonitorInterfaceBase>;
using IdleMonitorAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<IdleMonitorInterfaceBase>;
class IdleManagerInterfaceBase {};

using IdleManagerPtrDataView =
    mojo::InterfacePtrDataView<IdleManagerInterfaceBase>;
using IdleManagerRequestDataView =
    mojo::InterfaceRequestDataView<IdleManagerInterfaceBase>;
using IdleManagerAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<IdleManagerInterfaceBase>;
using IdleManagerAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<IdleManagerInterfaceBase>;


class IdleStateDataView {
 public:
  IdleStateDataView() = default;

  IdleStateDataView(
      internal::IdleState_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetIdleTimeDataView(
      ::mojo_base::mojom::TimeDeltaDataView* output);

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


}  // blink::mojom

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_IDLE_IDLE_MANAGER_MOJOM_DATA_VIEW_H_