nyantrack_common/
lists.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use super::{activity::ActivityPrivacy, entry::Entry};
6
7/// User Anime/Manga list
8#[derive(Debug, Serialize, Deserialize)]
9pub struct Lists {
10    /// Contains all of the entries that the user has given some status.
11    /// Individual status lists are derived at runtime.
12    entries: Vec<UserEntry>,
13    /// Any custom lists that the user has created
14    custom_lists: HashMap<String, Vec<UserEntry>>,
15}
16
17/// An entry plus related user-specific data
18#[derive(Debug, Serialize, Deserialize)]
19pub struct UserEntry {
20    entry: Entry,
21    rating: Rating,
22    note: String,
23    privacy: ActivityPrivacy,
24    status: Option<Status>,
25    watched: u32,
26    rewatches: u32,
27}
28
29#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
30pub enum Rating {
31    Thumbs(ThumbsRating),
32    Numeric(u8),
33}
34
35#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
36pub enum ThumbsRating {
37    Up,
38    Mid,
39    Down,
40}
41
42#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
43pub enum Status {
44    Current,
45    Re,
46    Complete,
47    Dropped,
48    Paused,
49    Planning,
50}