// media/mojo/mojom/media_drm_storage.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 MEDIA_MOJO_MOJOM_MEDIA_DRM_STORAGE_MOJOM_DATA_VIEW_H_
#define MEDIA_MOJO_MOJOM_MEDIA_DRM_STORAGE_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 "media/mojo/mojom/media_drm_storage.mojom-shared-internal.h"
#include "mojo/public/mojom/base/unguessable_token.mojom-shared.h"


namespace media::mojom {
class SessionDataDataView;



}  // media::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::media::mojom::SessionDataDataView> {
  using Data = ::media::mojom::internal::SessionData_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace media::mojom {
using SessionData_KeyType = mojo::NativeEnum;
// Interface base classes. They are used for type safety check.
class MediaDrmStorageInterfaceBase {};

using MediaDrmStoragePtrDataView =
    mojo::InterfacePtrDataView<MediaDrmStorageInterfaceBase>;
using MediaDrmStorageRequestDataView =
    mojo::InterfaceRequestDataView<MediaDrmStorageInterfaceBase>;
using MediaDrmStorageAssociatedPtrInfoDataView =
    mojo::AssociatedInterfacePtrInfoDataView<MediaDrmStorageInterfaceBase>;
using MediaDrmStorageAssociatedRequestDataView =
    mojo::AssociatedInterfaceRequestDataView<MediaDrmStorageInterfaceBase>;


class SessionDataDataView {
 public:
  SessionDataDataView() = default;

  SessionDataDataView(
      internal::SessionData_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

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

  template <typename UserType>
  [[nodiscard]] bool ReadKeySetId(UserType* output) {
    
    auto* pointer = data_->key_set_id.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>(
        pointer, output, message_);
  }
  inline void GetMimeTypeDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadMimeType(UserType* output) {
    
    auto* pointer = data_->mime_type.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadKeyType(UserType* output) const {
    auto data_value = data_->key_type;
    return mojo::internal::Deserialize<::media::mojom::SessionData_KeyType>(
        data_value, output);
  }
  SessionData_KeyType key_type() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::media::mojom::SessionData_KeyType>(data_->key_type));
  }
 private:
  internal::SessionData_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // media::mojom

#endif  // MEDIA_MOJO_MOJOM_MEDIA_DRM_STORAGE_MOJOM_DATA_VIEW_H_