// ui/gfx/mojom/hdr_metadata.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 UI_GFX_MOJOM_HDR_METADATA_MOJOM_DATA_VIEW_H_
#define UI_GFX_MOJOM_HDR_METADATA_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 "ui/gfx/mojom/hdr_metadata.mojom-shared-internal.h"
#include "skia/public/mojom/hdr_metadata.mojom-shared.h"
#include "skia/public/mojom/skcolorspace_primaries.mojom-shared.h"


namespace gfx::mojom {
class HdrMetadataExtendedRangeDataView;

class HDRMetadataDataView;



}  // gfx::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::gfx::mojom::HdrMetadataExtendedRangeDataView> {
  using Data = ::gfx::mojom::internal::HdrMetadataExtendedRange_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::gfx::mojom::HDRMetadataDataView> {
  using Data = ::gfx::mojom::internal::HDRMetadata_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace gfx::mojom {


class HdrMetadataExtendedRangeDataView {
 public:
  HdrMetadataExtendedRangeDataView() = default;

  HdrMetadataExtendedRangeDataView(
      internal::HdrMetadataExtendedRange_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  float current_headroom() const {
    return data_->current_headroom;
  }
  float desired_headroom() const {
    return data_->desired_headroom;
  }
 private:
  internal::HdrMetadataExtendedRange_Data* data_ = nullptr;
};


class HDRMetadataDataView {
 public:
  HDRMetadataDataView() = default;

  HDRMetadataDataView(
      internal::HDRMetadata_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  inline void GetMdcvDataView(
      ::skia::mojom::SkHdrMasteringDisplayColorVolumeDataView* output);

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

  template <typename UserType>
  [[nodiscard]] bool ReadClli(UserType* output) {
    
static_assert(
    mojo::internal::IsValidUserTypeForOptionalValue<
        ::skia::mojom::SkHdrContentLightLevelInformationDataView, UserType>(),
    "Attempting to read the optional `clli` 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 `MaybeReadClli` instead "
    "of `ReadClli if you're fine with null values being "
    "silently ignored in this case.");
    auto* pointer = data_->clli.Get();
    return mojo::internal::Deserialize<::skia::mojom::SkHdrContentLightLevelInformationDataView>(
        pointer, output, message_);
  }
  std::optional<float> ndwl() const {

    return data_->ndwl_$flag
        ? std::make_optional(data_->ndwl_$value)
        : std::nullopt;
  }
  inline void GetExtendedRangeDataView(
      HdrMetadataExtendedRangeDataView* output);

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

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


}  // gfx::mojom

#endif  // UI_GFX_MOJOM_HDR_METADATA_MOJOM_DATA_VIEW_H_