Files
whetstone_DSL/editor/src/graduation/EpochBlockHealthReBaselineModel.h

34 lines
947 B
C++

#pragma once
// Step 1329: Epoch block health re-baseline model.
#include <string>
#include <nlohmann/json.hpp>
struct EpochBlockHealthReBaselineModel {
std::string id;
std::string detail;
int score = 0;
bool enabled = false;
bool valid = false;
};
class EpochBlockHealthReBaselineModelFactory {
public:
static EpochBlockHealthReBaselineModel make(const std::string& id,
const std::string& detail,
int score,
bool enabled) {
bool valid = !id.empty() && !detail.empty() && score >= 0;
return {id, detail, score, enabled, valid};
}
static nlohmann::json toJson(const EpochBlockHealthReBaselineModel& v) {
nlohmann::json j = nlohmann::json::object();
j["id"] = v.id;
j["detail"] = v.detail;
j["score"] = v.score;
j["enabled"] = v.enabled;
j["valid"] = v.valid;
return j;
}
};