// This file was generated by generate-classes.
// DO NOT EDIT THIS FILE!
#pragma once

#include "Cesium3DTiles/ClassStatistics.h"
#include "Cesium3DTiles/Library.h"

#include <CesiumUtility/ExtensibleObject.h>

#include <unordered_map>

namespace Cesium3DTiles {
/**
 * @brief Statistics about entities.
 */
struct CESIUM3DTILES_API Statistics final
    : public CesiumUtility::ExtensibleObject {
  static inline constexpr const char* TypeName = "Statistics";

  /**
   * @brief A dictionary, where each key corresponds to a class ID in the
   * `classes` dictionary of the metatata schema that was defined for the
   * tileset that contains these statistics. Each value is an object containing
   * statistics about entities that conform to the class.
   */
  std::unordered_map<std::string, Cesium3DTiles::ClassStatistics> classes;

  /**
   * @brief Calculates the size in bytes of this object, including the contents
   * of all collections, pointers, and strings. This will NOT include the size
   * of any extensions attached to the object. Calling this method may be slow
   * as it requires traversing the object's entire structure.
   */
  int64_t getSizeBytes() const {
    int64_t accum = 0;
    accum += int64_t(sizeof(Statistics));
    accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
             int64_t(sizeof(CesiumUtility::ExtensibleObject));
    accum += int64_t(
        this->classes.bucket_count() *
        (sizeof(std::string) + sizeof(Cesium3DTiles::ClassStatistics)));
    for (const auto& [k, v] : this->classes) {
      accum += int64_t(k.capacity() * sizeof(char) - sizeof(std::string));
      accum +=
          v.getSizeBytes() - int64_t(sizeof(Cesium3DTiles::ClassStatistics));
    }
    return accum;
  }
};
} // namespace Cesium3DTiles
