// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef CRUBIT_RS_BINDINGS_FROM_CC_COLLECT_NAMESPACES_H_
#define CRUBIT_RS_BINDINGS_FROM_CC_COLLECT_NAMESPACES_H_

#include <ostream>
#include <string>
#include <vector>

#include "rs_bindings_from_cc/bazel_types.h"
#include "rs_bindings_from_cc/ir.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/JSON.h"

namespace crubit {

// Representation of a C++ namespace for JSON serialization.
// This structure differs from the Namespace struct in ir.h in that it only
// stores the names of the namespace children, as it is the only information
// that the cc_import! macro needs in order to be able to merge namespaces
// across targets.
struct NamespaceNode {
  llvm::json::Value ToJson() const;

  std::string name;
  std::vector<NamespaceNode> children;
};

inline std::ostream& operator<<(std::ostream& o, const NamespaceNode& ns) {
  return o << std::string(llvm::formatv("{0:2}", ns.ToJson()));
}

// Representation of all C++ namespaces within the current target.
struct NamespacesHierarchy {
  llvm::json::Value ToJson() const;

  BazelLabel label;
  std::vector<NamespaceNode> namespaces;
};

inline std::ostream& operator<<(std::ostream& o,
                                const NamespacesHierarchy& all) {
  return o << std::string(llvm::formatv("{0:2}", all.ToJson()));
}

// Returns the current target's namespace hierarchy in JSON serializable format.
NamespacesHierarchy CollectNamespaces(const IR& ir);

inline std::string NamespacesAsJson(const NamespacesHierarchy& topLevel) {
  return llvm::formatv("{0:2}", topLevel.ToJson());
}
}  // namespace crubit

#endif  // CRUBIT_RS_BINDINGS_FROM_CC_COLLECT_NAMESPACES_H_
