// device/bluetooth/public/mojom/gatt_service_error_code.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#include "device/bluetooth/public/mojom/gatt_service_error_code.mojom-shared.h"
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "device/bluetooth/public/mojom/gatt_service_error_code.mojom-params-data.h"
namespace bluetooth {
namespace mojom {

NOINLINE static const char* GattServiceErrorCodeToStringHelper(GattServiceErrorCode value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case GattServiceErrorCode::kUnknown:
      return "kUnknown";
    case GattServiceErrorCode::kFailed:
      return "kFailed";
    case GattServiceErrorCode::kInProgress:
      return "kInProgress";
    case GattServiceErrorCode::kInvalidLength:
      return "kInvalidLength";
    case GattServiceErrorCode::kNotPermitted:
      return "kNotPermitted";
    case GattServiceErrorCode::kNotAuthorized:
      return "kNotAuthorized";
    case GattServiceErrorCode::kNotPaired:
      return "kNotPaired";
    case GattServiceErrorCode::kNotSupported:
      return "kNotSupported";
    default:
      return nullptr;
  }
}

std::string GattServiceErrorCodeToString(GattServiceErrorCode value) {
  const char *str = GattServiceErrorCodeToStringHelper(value);
  if (!str) {
    return base::StringPrintf("Unknown GattServiceErrorCode value: %i", static_cast<int32_t>(value));
  }
  return str;
}

std::ostream& operator<<(std::ostream& os, GattServiceErrorCode value) {
  return os << GattServiceErrorCodeToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace bluetooth

namespace perfetto {

// static
void TraceFormatTraits<::bluetooth::mojom::GattServiceErrorCode>::WriteIntoTrace(
   perfetto::TracedValue context, ::bluetooth::mojom::GattServiceErrorCode value) {
  return std::move(context).WriteString(::bluetooth::mojom::GattServiceErrorCodeToString(value));
}

} // namespace perfetto