#include "model/NotificationType.hpp" #include #include "spec/WireEnums.hpp" namespace dp { const std::array& NotificationType::all() { static const std::array values = {NotificationType(NotificationType::Comment), NotificationType(NotificationType::Reply), NotificationType(NotificationType::Mention), NotificationType(NotificationType::Vote), NotificationType(NotificationType::Message), NotificationType(NotificationType::Issue), NotificationType(NotificationType::Badge)}; return values; } const char* NotificationType::raw() const { return spec::WireEnums::kNotificationType[static_cast(value_)]; } std::optional NotificationType::fromRaw(const std::string& raw) { for (const auto& v : all()) { if (raw == v.raw()) return v; } return std::nullopt; } } // namespace dp