// device/bluetooth/public/mojom/gatt_characteristic_permissions.mojom-blink.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 "device/bluetooth/public/mojom/gatt_characteristic_permissions.mojom-blink.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 "device/bluetooth/public/mojom/gatt_characteristic_permissions.mojom-params-data.h"
#include "device/bluetooth/public/mojom/gatt_characteristic_permissions.mojom-shared-message-ids.h"

#include "device/bluetooth/public/mojom/gatt_characteristic_permissions.mojom-blink-import-headers.h"
#include "device/bluetooth/public/mojom/gatt_characteristic_permissions.mojom-blink-test-utils.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


namespace bluetooth::mojom::blink {
GattCharacteristicPermissions::GattCharacteristicPermissions()
    : read(),
      write(),
      read_encrypted(),
      write_encrypted(),
      read_encrypted_authenticated(),
      write_encrypted_authenticated() {}

GattCharacteristicPermissions::GattCharacteristicPermissions(
    bool read_in,
    bool write_in,
    bool read_encrypted_in,
    bool write_encrypted_in,
    bool read_encrypted_authenticated_in,
    bool write_encrypted_authenticated_in)
    : read(std::move(read_in)),
      write(std::move(write_in)),
      read_encrypted(std::move(read_encrypted_in)),
      write_encrypted(std::move(write_encrypted_in)),
      read_encrypted_authenticated(std::move(read_encrypted_authenticated_in)),
      write_encrypted_authenticated(std::move(write_encrypted_authenticated_in)) {}

GattCharacteristicPermissions::~GattCharacteristicPermissions() = default;
size_t GattCharacteristicPermissions::Hash(size_t seed) const {
  seed = mojo::internal::WTFHash(seed, this->read);
  seed = mojo::internal::WTFHash(seed, this->write);
  seed = mojo::internal::WTFHash(seed, this->read_encrypted);
  seed = mojo::internal::WTFHash(seed, this->write_encrypted);
  seed = mojo::internal::WTFHash(seed, this->read_encrypted_authenticated);
  seed = mojo::internal::WTFHash(seed, this->write_encrypted_authenticated);
  return seed;
}

void GattCharacteristicPermissions::WriteIntoTrace(
    perfetto::TracedValue traced_context) const {
  [[maybe_unused]] auto dict = std::move(traced_context).WriteDictionary();
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "read"), this->read,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "write"), this->write,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "read_encrypted"), this->read_encrypted,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "write_encrypted"), this->write_encrypted,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "read_encrypted_authenticated"), this->read_encrypted_authenticated,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
  perfetto::WriteIntoTracedValueWithFallback(
    dict.AddItem(
      "write_encrypted_authenticated"), this->write_encrypted_authenticated,
#if BUILDFLAG(MOJO_TRACE_ENABLED)
      "<value of type bool>"
#else
      "<value>"
#endif  // BUILDFLAG(MOJO_TRACE_ENABLED)
    );
}

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


}  // bluetooth::mojom::blink


namespace mojo {


// static
bool StructTraits<::bluetooth::mojom::blink::GattCharacteristicPermissions::DataView, ::bluetooth::mojom::blink::GattCharacteristicPermissionsPtr>::Read(
    ::bluetooth::mojom::blink::GattCharacteristicPermissions::DataView input,
    ::bluetooth::mojom::blink::GattCharacteristicPermissionsPtr* output) {
  bool success = true;
  ::bluetooth::mojom::blink::GattCharacteristicPermissionsPtr result(::bluetooth::mojom::blink::GattCharacteristicPermissions::New());
  
      if (success)
        result->read = input.read();
      if (success)
        result->write = input.write();
      if (success)
        result->read_encrypted = input.read_encrypted();
      if (success)
        result->write_encrypted = input.write_encrypted();
      if (success)
        result->read_encrypted_authenticated = input.read_encrypted_authenticated();
      if (success)
        result->write_encrypted_authenticated = input.write_encrypted_authenticated();
  *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 bluetooth::mojom::blink {




}  // bluetooth::mojom::blink


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