// chrome/enterprise_companion/mojom/policy_fetch_reason.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 "chrome/enterprise_companion/mojom/policy_fetch_reason.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 "chrome/enterprise_companion/mojom/policy_fetch_reason.mojom-params-data.h"
namespace enterprise_companion {
namespace mojom {

NOINLINE static const char* PolicyFetchReasonToStringHelper(PolicyFetchReason value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case PolicyFetchReason::UNSPECIFIED:
      return "UNSPECIFIED";
    case PolicyFetchReason::USER_REQUEST:
      return "USER_REQUEST";
    case PolicyFetchReason::SCHEDULED:
      return "SCHEDULED";
    default:
      return nullptr;
  }
}

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

std::ostream& operator<<(std::ostream& os, PolicyFetchReason value) {
  return os << PolicyFetchReasonToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace enterprise_companion

namespace perfetto {

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

} // namespace perfetto