1#pragma once
2
3/// @file
4/// @brief An event describing, if guest accounts can join a room.
5
6#if __has_include(<nlohmann/json_fwd.hpp>)
7#include <nlohmann/json_fwd.hpp>
8#else
9#include <nlohmann/json.hpp>
10#endif
11
12#include <string>
13
14namespace mtx {
15namespace events {
16namespace state {
17
18//! The different access states for a room.
19enum class AccessState
20{
21 CanJoin, //! Joining is allowd (for guests)
22 Forbidden, //! Guests can't join.
23};
24
25//! Converts @p AccessState to @p std::string for serialization.
26std::string
27accessStateToString(AccessState state);
28
29//! Converts @p std::string to @p AccessState for deserialization.
30AccessState
31stringToAccessState(const std::string &state);
32
33//! Content of the `m.room.guest_access` state event.
34struct GuestAccess
35{
36 //! Whether guests can join the room.
37 AccessState guest_access = AccessState::Forbidden;
38
39 friend void from_json(const nlohmann::json &obj, GuestAccess &guest_access);
40 friend void to_json(nlohmann::json &obj, const GuestAccess &guest_access);
41};
42
43} // namespace state
44} // namespace events
45} // namespace mtx
46