#pragma once #include "common/Aliases.hpp" #include "util/ThreadGuard.hpp" #include #include #include #include #include #include #include namespace chatterino { struct Emote; using EmotePtr = std::shared_ptr; class FfzBadges { public: FfzBadges() = default; struct Badge { EmotePtr emote; QColor color; }; std::vector getUserBadges(const UserId &id); std::optional getBadge(int badgeID) const; void registerBadge(int badgeID, Badge badge); void assignBadgeToUser(const UserId &userID, int badgeID); void load(); private: std::shared_mutex mutex_; // userBadges points a user ID to the list of badges they have std::unordered_map> userBadges; // badges points a badge ID to the information about the badge std::unordered_map badges; ThreadGuard tgBadges; }; } // namespace chatterino