#pragma once // Spec: models.md Message. Wire wrapper: message, sender, is_mine, attachments. #include #include #include "core/Date.hpp" #include "core/Json.hpp" #include "model/Attachment.hpp" #include "model/User.hpp" namespace dp { struct Message { struct Data { std::string id; std::string senderId; std::string receiverId; std::string content; bool read = false; Date createdAt{}; static Data fromJson(const Json& j); }; Data data; User sender; bool isMine = false; std::vector attachments; static Message fromJson(const Json& j); std::string id() const { return "message:" + data.id; } }; } // namespace dp