#pragma once // Spec: models.md Project (FLAT wire: entity fields at top level plus author_name, my_vote, recent_comments). // Project::Data::fromJson reads the same keys from a standalone object (ProjectDetail.project, Profile.projects). #include #include #include #include #include "core/Date.hpp" #include "core/Json.hpp" #include "model/Comment.hpp" #include "model/Vote.hpp" namespace dp { struct Project { struct Data { std::string id; std::string slug; std::string userId; std::string title; std::string description; std::string projectType; std::string status; std::int64_t stars = 0; std::optional isPrivate; std::optional readOnly; std::optional releaseDate; std::optional demoDate; Date createdAt{}; std::optional updatedAt; static Data fromJson(const Json& j); }; Data data; std::string authorName; Vote myVote; std::vector recentComments; static Project fromJson(const Json& j); std::string id() const { return "project:" + data.id; } }; } // namespace dp