9
+ − 1 #ifndef __core__anime_h
+ − 2 #define __core__anime_h
+ − 3 #include "core/date.h"
+ − 4 #include <array>
+ − 5 #include <map>
+ − 6 #include <vector>
+ − 7
+ − 8 namespace Anime {
+ − 9
+ − 10 enum class ListStatus {
+ − 11 NOT_IN_LIST,
+ − 12 CURRENT,
+ − 13 COMPLETED,
51
+ − 14 PAUSED,
9
+ − 15 DROPPED,
51
+ − 16 PLANNING
9
+ − 17 };
+ − 18
15
+ − 19 constexpr std::array<ListStatus, 5> ListStatuses{ListStatus::CURRENT, ListStatus::COMPLETED, ListStatus::PAUSED,
+ − 20 ListStatus::DROPPED, ListStatus::PLANNING};
9
+ − 21
+ − 22 enum class SeriesStatus {
+ − 23 UNKNOWN,
+ − 24 FINISHED,
+ − 25 RELEASING,
+ − 26 NOT_YET_RELEASED,
+ − 27 CANCELLED,
+ − 28 HIATUS
+ − 29 };
+ − 30
+ − 31 enum class SeriesFormat {
+ − 32 UNKNOWN,
+ − 33 TV,
+ − 34 TV_SHORT,
+ − 35 MOVIE,
+ − 36 SPECIAL,
+ − 37 OVA,
+ − 38 ONA,
+ − 39 MUSIC,
+ − 40 MANGA,
+ − 41 NOVEL,
+ − 42 ONE_SHOT
+ − 43 };
+ − 44
+ − 45 enum class SeriesSeason {
+ − 46 UNKNOWN,
+ − 47 WINTER,
+ − 48 SPRING,
+ − 49 SUMMER,
+ − 50 FALL
+ − 51 };
+ − 52
+ − 53 enum class TitleLanguage {
+ − 54 ROMAJI,
+ − 55 NATIVE,
+ − 56 ENGLISH
+ − 57 };
+ − 58
+ − 59 enum class Services {
+ − 60 NONE,
+ − 61 ANILIST,
+ − 62 NB_SERVICES
+ − 63 };
+ − 64
+ − 65 struct ListInformation {
15
+ − 66 int id = 0;
+ − 67 int progress = 0;
+ − 68 int score = 0;
+ − 69 ListStatus status = ListStatus::NOT_IN_LIST;
+ − 70 Date started;
+ − 71 Date completed;
+ − 72 bool is_private = false;
+ − 73 unsigned int rewatched_times = 0;
+ − 74 bool rewatching = false;
+ − 75 uint64_t updated = 0;
+ − 76 std::string notes;
9
+ − 77 };
+ − 78
+ − 79 struct SeriesInformation {
15
+ − 80 int id;
+ − 81 struct {
+ − 82 std::string romaji;
+ − 83 std::string english;
+ − 84 std::string native;
+ − 85 } title;
+ − 86 std::vector<std::string> synonyms;
+ − 87 int episodes = 0;
+ − 88 SeriesStatus status = SeriesStatus::UNKNOWN;
+ − 89 Date air_date;
+ − 90 std::vector<std::string> genres;
+ − 91 std::vector<std::string> producers;
+ − 92 SeriesFormat format = SeriesFormat::UNKNOWN;
+ − 93 SeriesSeason season = SeriesSeason::UNKNOWN;
+ − 94 int audience_score = 0;
+ − 95 std::string synopsis;
+ − 96 int duration = 0;
9
+ − 97 };
+ − 98
+ − 99 class Anime {
+ − 100 public:
+ − 101 /* User list data */
+ − 102 ListStatus GetUserStatus() const;
+ − 103 int GetUserProgress() const;
+ − 104 int GetUserScore() const;
+ − 105 Date GetUserDateStarted() const;
+ − 106 Date GetUserDateCompleted() const;
+ − 107 bool GetUserIsPrivate() const;
+ − 108 unsigned int GetUserRewatchedTimes() const;
+ − 109 bool GetUserIsRewatching() const;
+ − 110 uint64_t GetUserTimeUpdated() const;
+ − 111 std::string GetUserNotes() const;
+ − 112
+ − 113 void SetUserStatus(ListStatus status);
10
+ − 114 void SetUserScore(int score);
9
+ − 115 void SetUserProgress(int progress);
+ − 116 void SetUserDateStarted(Date const& started);
+ − 117 void SetUserDateCompleted(Date const& completed);
+ − 118 void SetUserIsPrivate(bool is_private);
+ − 119 void SetUserRewatchedTimes(int rewatched);
+ − 120 void SetUserIsRewatching(bool rewatching);
+ − 121 void SetUserTimeUpdated(uint64_t updated);
+ − 122 void SetUserNotes(std::string const& notes);
+ − 123
+ − 124 /* Series data */
+ − 125 int GetId() const;
+ − 126 std::string GetRomajiTitle() const;
+ − 127 std::string GetEnglishTitle() const;
+ − 128 std::string GetNativeTitle() const;
+ − 129 std::vector<std::string> GetTitleSynonyms() const;
+ − 130 int GetEpisodes() const;
+ − 131 SeriesStatus GetAiringStatus() const;
+ − 132 Date GetAirDate() const;
+ − 133 std::vector<std::string> GetGenres() const;
+ − 134 std::vector<std::string> GetProducers() const;
+ − 135 SeriesFormat GetFormat() const;
+ − 136 SeriesSeason GetSeason() const;
+ − 137 int GetAudienceScore() const; /* should be double once MAL and Kitsu are implemented */
+ − 138 std::string GetSynopsis() const;
+ − 139 int GetDuration() const;
+ − 140
+ − 141 void SetId(int id);
+ − 142 void SetRomajiTitle(std::string const& title);
+ − 143 void SetEnglishTitle(std::string const& title);
+ − 144 void SetNativeTitle(std::string const& title);
+ − 145 void SetTitleSynonyms(std::vector<std::string> const& synonyms);
+ − 146 void AddTitleSynonym(std::string const& synonym);
+ − 147 void SetEpisodes(int episodes);
+ − 148 void SetAiringStatus(SeriesStatus status);
+ − 149 void SetAirDate(Date const& date);
+ − 150 void SetGenres(std::vector<std::string> const& genres);
+ − 151 void SetProducers(std::vector<std::string> const& producers);
+ − 152 void SetFormat(SeriesFormat format);
+ − 153 void SetSeason(SeriesSeason season);
+ − 154 void SetAudienceScore(int audience_score);
+ − 155 void SetSynopsis(std::string synopsis);
+ − 156 void SetDuration(int duration);
+ − 157
+ − 158 std::string GetUserPreferredTitle() const;
+ − 159
+ − 160 /* User stuff */
+ − 161 void AddToUserList();
+ − 162 bool IsInUserList() const;
+ − 163 void RemoveFromUserList();
+ − 164
+ − 165 private:
+ − 166 SeriesInformation info_;
10
+ − 167 std::shared_ptr<struct ListInformation> list_info_;
9
+ − 168 };
+ − 169
+ − 170 } // namespace Anime
+ − 171
51
+ − 172 #endif // __core__anime_h