// services/network/public/mojom/signed_certificate_timestamp.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 SERVICES_NETWORK_PUBLIC_MOJOM_SIGNED_CERTIFICATE_TIMESTAMP_MOJOM_DATA_VIEW_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_SIGNED_CERTIFICATE_TIMESTAMP_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 "services/network/public/mojom/signed_certificate_timestamp.mojom-shared-internal.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"


namespace network::mojom {
class DigitallySignedDataView;

class SignedCertificateTimestampDataView;



}  // network::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::network::mojom::DigitallySignedDataView> {
  using Data = ::network::mojom::internal::DigitallySigned_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::network::mojom::SignedCertificateTimestampDataView> {
  using Data = ::network::mojom::internal::SignedCertificateTimestamp_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace network::mojom {


enum class HashAlgorithm : int32_t {
  
  HASH_ALGO_NONE = 0,
  
  HASH_ALGO_MD5 = 1,
  
  HASH_ALGO_SHA1 = 2,
  
  HASH_ALGO_SHA224 = 3,
  
  HASH_ALGO_SHA256 = 4,
  
  HASH_ALGO_SHA384 = 5,
  
  HASH_ALGO_SHA512 = 6,
  kMinValue = 0,
  kMaxValue = 6,
};

 std::ostream& operator<<(std::ostream& os, HashAlgorithm value);
inline bool IsKnownEnumValue(HashAlgorithm value) {
  return internal::HashAlgorithm_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(HashAlgorithm) {
  return true;
}


enum class SignatureAlgorithm : int32_t {
  
  SIG_ALGO_ANONYMOUS = 0,
  
  SIG_ALGO_RSA = 1,
  
  SIG_ALGO_DSA = 2,
  
  SIG_ALGO_ECDSA = 3,
  kMinValue = 0,
  kMaxValue = 3,
};

 std::ostream& operator<<(std::ostream& os, SignatureAlgorithm value);
inline bool IsKnownEnumValue(SignatureAlgorithm value) {
  return internal::SignatureAlgorithm_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(SignatureAlgorithm) {
  return true;
}


enum class SCTVersion : int32_t {
  
  kV1 = 0,
  kMinValue = 0,
  kMaxValue = 0,
};

 std::ostream& operator<<(std::ostream& os, SCTVersion value);
inline bool IsKnownEnumValue(SCTVersion value) {
  return internal::SCTVersion_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(SCTVersion) {
  return true;
}


enum class SCTOrigin : int32_t {
  
  kEmbedded = 0,
  
  kFromTlsExtension = 1,
  
  kFromOcspResponse = 2,
  kMinValue = 0,
  kMaxValue = 2,
};

 std::ostream& operator<<(std::ostream& os, SCTOrigin value);
inline bool IsKnownEnumValue(SCTOrigin value) {
  return internal::SCTOrigin_Data::IsKnownValue(
      static_cast<int32_t>(value));
}

// Returns true if the enum has an infallible conversion from the mojom enum.
consteval bool HasInfallibleConversion(SCTOrigin) {
  return true;
}


class DigitallySignedDataView {
 public:
  DigitallySignedDataView() = default;

  DigitallySignedDataView(
      internal::DigitallySigned_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  template <typename UserType>
  [[nodiscard]] bool ReadHashAlgorithm(UserType* output) const {
    auto data_value = data_->hash_algorithm;
    return mojo::internal::Deserialize<::network::mojom::HashAlgorithm>(
        data_value, output);
  }
  HashAlgorithm hash_algorithm() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::HashAlgorithm>(data_->hash_algorithm));
  }
  template <typename UserType>
  [[nodiscard]] bool ReadSignatureAlgorithm(UserType* output) const {
    auto data_value = data_->signature_algorithm;
    return mojo::internal::Deserialize<::network::mojom::SignatureAlgorithm>(
        data_value, output);
  }
  SignatureAlgorithm signature_algorithm() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::SignatureAlgorithm>(data_->signature_algorithm));
  }
  inline void GetSignatureDataView(
      mojo::ArrayDataView<uint8_t>* output);

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


class SignedCertificateTimestampDataView {
 public:
  SignedCertificateTimestampDataView() = default;

  SignedCertificateTimestampDataView(
      internal::SignedCertificateTimestamp_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  template <typename UserType>
  [[nodiscard]] bool ReadVersion(UserType* output) const {
    auto data_value = data_->version;
    return mojo::internal::Deserialize<::network::mojom::SCTVersion>(
        data_value, output);
  }
  SCTVersion version() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::SCTVersion>(data_->version));
  }
  inline void GetLogIdDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadLogId(UserType* output) {
    
    auto* pointer = data_->log_id.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
  inline void GetTimestampDataView(
      ::mojo_base::mojom::TimeDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadTimestamp(UserType* output) {
    
    auto* pointer = data_->timestamp.Get();
    return mojo::internal::Deserialize<::mojo_base::mojom::TimeDataView>(
        pointer, output, message_);
  }
  inline void GetExtensionsDataView(
      mojo::ArrayDataView<uint8_t>* output);

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

  template <typename UserType>
  [[nodiscard]] bool ReadSignature(UserType* output) {
    
    auto* pointer = data_->signature.Get();
    return mojo::internal::Deserialize<::network::mojom::DigitallySignedDataView>(
        pointer, output, message_);
  }
  template <typename UserType>
  [[nodiscard]] bool ReadOrigin(UserType* output) const {
    auto data_value = data_->origin;
    return mojo::internal::Deserialize<::network::mojom::SCTOrigin>(
        data_value, output);
  }
  SCTOrigin origin() const {
    return ::mojo::internal::ToKnownEnumValueHelper(
          static_cast<::network::mojom::SCTOrigin>(data_->origin));
  }
  inline void GetLogDescriptionDataView(
      mojo::StringDataView* output);

  template <typename UserType>
  [[nodiscard]] bool ReadLogDescription(UserType* output) {
    
    auto* pointer = data_->log_description.Get();
    return mojo::internal::Deserialize<mojo::StringDataView>(
        pointer, output, message_);
  }
 private:
  internal::SignedCertificateTimestamp_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // network::mojom

#endif  // SERVICES_NETWORK_PUBLIC_MOJOM_SIGNED_CERTIFICATE_TIMESTAMP_MOJOM_DATA_VIEW_H_