// services/network/public/mojom/signed_certificate_timestamp.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "services/network/public/mojom/signed_certificate_timestamp.mojom.h"
#include <stdint.h>
#include <utility>
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "services/network/public/mojom/signed_certificate_timestamp.mojom-params-data.h"
#include "services/network/public/mojom/signed_certificate_timestamp.mojom-shared-message-ids.h"

#include "services/network/public/mojom/signed_certificate_timestamp.mojom-import-headers.h"
#include "services/network/public/mojom/signed_certificate_timestamp.mojom-test-utils.h"


namespace network::mojom {
DigitallySigned::DigitallySigned()
    : hash_algorithm(),
      signature_algorithm(),
      signature() {}

DigitallySigned::DigitallySigned(
    ::net::ct::DigitallySigned::HashAlgorithm hash_algorithm_in,
    ::net::ct::DigitallySigned::SignatureAlgorithm signature_algorithm_in,
    std::vector<uint8_t> signature_in)
    : hash_algorithm(std::move(hash_algorithm_in)),
      signature_algorithm(std::move(signature_algorithm_in)),
      signature(std::move(signature_in)) {}

DigitallySigned::~DigitallySigned() = default;

void DigitallySigned::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "hash_algorithm"), this->hash_algorithm,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::net::ct::DigitallySigned::HashAlgorithm>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "signature_algorithm"), this->signature_algorithm,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::net::ct::DigitallySigned::SignatureAlgorithm>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "signature"), this->signature,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::vector<uint8_t>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool DigitallySigned::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
SignedCertificateTimestamp::SignedCertificateTimestamp()
    : version(),
      log_id(),
      timestamp(),
      extensions(),
      signature(),
      origin(),
      log_description() {}

SignedCertificateTimestamp::SignedCertificateTimestamp(
    ::net::ct::SignedCertificateTimestamp::Version version_in,
    const std::string& log_id_in,
    ::base::Time timestamp_in,
    std::vector<uint8_t> extensions_in,
    const ::net::ct::DigitallySigned& signature_in,
    ::net::ct::SignedCertificateTimestamp::Origin origin_in,
    const std::string& log_description_in)
    : version(std::move(version_in)),
      log_id(std::move(log_id_in)),
      timestamp(std::move(timestamp_in)),
      extensions(std::move(extensions_in)),
      signature(std::move(signature_in)),
      origin(std::move(origin_in)),
      log_description(std::move(log_description_in)) {}

SignedCertificateTimestamp::~SignedCertificateTimestamp() = default;

void SignedCertificateTimestamp::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "version"), this->version,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::net::ct::SignedCertificateTimestamp::Version>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "log_id"), this->log_id,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "timestamp"), this->timestamp,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::base::Time>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "extensions"), this->extensions,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::vector<uint8_t>&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "signature"), this->signature,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const ::net::ct::DigitallySigned&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "origin"), this->origin,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type ::net::ct::SignedCertificateTimestamp::Origin>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "log_description"), this->log_description,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type const std::string&>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

bool SignedCertificateTimestamp::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}


}  // network::mojom


namespace mojo {


// static
bool StructTraits<::network::mojom::DigitallySigned::DataView, ::network::mojom::DigitallySignedPtr>::Read(
    ::network::mojom::DigitallySigned::DataView input,
    ::network::mojom::DigitallySignedPtr* output) {
  bool success = true;
  ::network::mojom::DigitallySignedPtr result(::network::mojom::DigitallySigned::New());
  
      if (success && !input.ReadHashAlgorithm(&result->hash_algorithm))
        success = false;
      if (success && !input.ReadSignatureAlgorithm(&result->signature_algorithm))
        success = false;
      if (success && !input.ReadSignature(&result->signature))
        success = false;
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::network::mojom::SignedCertificateTimestamp::DataView, ::network::mojom::SignedCertificateTimestampPtr>::Read(
    ::network::mojom::SignedCertificateTimestamp::DataView input,
    ::network::mojom::SignedCertificateTimestampPtr* output) {
  bool success = true;
  ::network::mojom::SignedCertificateTimestampPtr result(::network::mojom::SignedCertificateTimestamp::New());
  
      if (success && !input.ReadVersion(&result->version))
        success = false;
      if (success && !input.ReadLogId(&result->log_id))
        success = false;
      if (success && !input.ReadTimestamp(&result->timestamp))
        success = false;
      if (success && !input.ReadExtensions(&result->extensions))
        success = false;
      if (success && !input.ReadSignature(&result->signature))
        success = false;
      if (success && !input.ReadOrigin(&result->origin))
        success = false;
      if (success && !input.ReadLogDescription(&result->log_description))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo


// Symbols declared in the -test-utils.h header are defined here instead of a
// separate .cc file to save compile time.


namespace network::mojom {




}  // network::mojom


#if defined(__clang__)
#pragma clang diagnostic pop
#endif