1#pragma once
2
3/// @file
4/// @brief Events describing room tags.
5
6#include <optional>
7#include <string>
8
9#if __has_include(<nlohmann/json_fwd.hpp>)
10#include <nlohmann/json_fwd.hpp>
11#else
12#include <nlohmann/json.hpp>
13#endif
14
15namespace mtx {
16namespace events {
17//! Namespace for events in account_data
18namespace account_data {
19//! The content of a tag.
20struct Tag
21{
22 //! A number in a range [0,1] describing a relative position of the room under
23 //! the given tag.
24 std::optional<double> order;
25
26 friend void from_json(const nlohmann::json &obj, Tag &content);
27 friend void to_json(nlohmann::json &obj, const Tag &content);
28};
29
30//! Content for the `m.tag` room account_data event.
31//! A tag is a short string a client can attach to a room for sorting or advanced functionality.
32struct Tags
33{
34 //! The tags on the room and their contents.
35 std::map<std::string, Tag> tags;
36
37 friend void from_json(const nlohmann::json &obj, Tags &content);
38 friend void to_json(nlohmann::json &obj, const Tags &content);
39};
40
41} // namespace account_data
42} // namespace events
43} // namespace mtx
44