1 module models;
2 import asdf;
3 
4 struct NewSource {
5     string url;
6     string name;
7     int interval;
8 }
9 
10 struct FeedsFrequency
11 {
12     double perDay;
13     double perWeek;
14     double perMonth;
15 }
16 
17 struct Ignore {
18 
19 }
20 
21 struct Alias {
22     string name;
23 }
24 
25 struct SourceOverview
26 {
27     @Ignore()
28     ulong sourceId;
29     @Alias("Unread Count")
30     uint unreadCount;
31     @Alias("Favorites Count")
32     uint favoritesCount;
33     @Alias("Feeds Count")
34     uint feedsCount;
35     @Ignore()
36     FeedsFrequency frequency;
37 }
38 
39 enum State
40 {
41     Neutral,
42     Enabled,
43     Disabled
44 }
45 
46 struct SourceViewDto
47 {
48     ulong id;
49     string url;
50     string name;
51     uint interval;
52     @Ignore()
53     string normalized;
54     @Alias("Last Update")
55     string lastUpdate;
56     uint count;
57 }
58 
59 struct FeedDto
60 {
61     ulong sourceId;
62     string url;
63     string title;
64     string author;
65     string publishedDate;
66     @serdeOptional string description;
67     @serdeOptional string content;
68     @serdeKeys("favorite") bool isFavorite;
69     @serdeKeys("read") bool isRead;
70     @serdeKeys("delete") bool isDeleted;
71 }
72 
73 struct Page
74 {
75     int total;
76     FeedDto[] resources;
77 
78     public bool isEmpty() {
79         return total == 0;
80     }
81 }
82