1 package com.moiseum.wolnelektury.connection.models;
3 import com.google.gson.annotations.SerializedName;
4 import com.moiseum.wolnelektury.storage.StringListConverter;
6 import org.parceler.Parcel;
10 import io.objectbox.annotation.Convert;
11 import io.objectbox.annotation.Entity;
12 import io.objectbox.annotation.Id;
15 * Created by piotrostrowski on 16.11.2017.
18 @Parcel(Parcel.Serialization.BEAN)
20 public class BookModel {
22 @Id(assignable = true)
25 // API provided fields
27 private String author;
29 @SerializedName("has_audio")
30 private boolean hasAudio;
37 @SerializedName("cover_color")
38 private String coverColor;
40 @SerializedName("full_sort_key")
41 private String sortedKey;
42 @SerializedName("simple_thumb")
43 private String coverThumb;
44 private boolean liked;
46 // Locally stored fields
47 private String ebookName;
48 private int currentChapter;
49 private int totalChapters;
50 private String ebookFileUrl;
51 private int currentAudioChapter;
52 private int totalAudioChapters;
53 @Convert(converter = StringListConverter.class, dbType = String.class)
54 private List<String> audioFileUrls;
59 public long getLocalId() {
63 public void setLocalId(long localId) {
64 this.localId = localId;
67 public String getKind() {
71 public void setKind(String kind) {
75 public String getAuthor() {
79 public void setAuthor(String author) {
83 public String getUrl() {
87 public void setUrl(String url) {
91 public String getTitle() {
95 public void setTitle(String title) {
99 public boolean isHasAudio() {
103 public void setHasAudio(boolean hasAudio) {
104 this.hasAudio = hasAudio;
107 public String getCover() {
111 public void setCover(String cover) {
115 public String getEpoch() {
119 public void setEpoch(String epoch) {
123 public String getHref() {
127 public void setHref(String href) {
131 public String getGenre() {
135 public void setGenre(String genre) {
139 public String getSlug() {
143 public String getCoverColor(){return coverColor;}
145 public void setCoverColor(String coverColor){this.coverColor=coverColor;}
147 public void setSlug(String slug) {
151 public String getKey() {
155 public void setKey(String key) {
159 public String getSortedKey() {
163 public void setSortedKey(String sortedKey) {
164 this.sortedKey = sortedKey;
167 public String getCoverThumb() {
171 public void setCoverThumb(String coverThumb) {
172 this.coverThumb = coverThumb;
175 public String getEbookName() {
179 public void setEbookName(String ebookName) {
180 this.ebookName = ebookName;
183 public int getCurrentChapter() {
184 return currentChapter;
187 public void setCurrentChapter(int currentChapter) {
188 this.currentChapter = currentChapter;
191 public int getTotalChapters() {
192 return totalChapters;
195 public void setTotalChapters(int totalChapters) {
196 this.totalChapters = totalChapters;
199 public String getEbookFileUrl() {
203 public void setEbookFileUrl(String ebookFileUrl) {
204 this.ebookFileUrl = ebookFileUrl;
207 public int getCurrentAudioChapter() {
208 return currentAudioChapter;
211 public void setCurrentAudioChapter(int currentAudioChapter) {
212 this.currentAudioChapter = currentAudioChapter;
215 public int getTotalAudioChapters() {
216 return totalAudioChapters;
219 public void setTotalAudioChapters(int totalAudioChapters) {
220 this.totalAudioChapters = totalAudioChapters;
223 public List<String> getAudioFileUrls() {
224 return audioFileUrls;
227 public void setAudioFileUrls(List<String> audioFileUrls) {
228 this.audioFileUrls = audioFileUrls;
231 public boolean isEbookDownloaded() {
232 return ebookFileUrl != null;
235 public boolean isAudioDownloaded() {
236 return audioFileUrls != null && audioFileUrls.size() > 0;
239 public boolean isDeletable() {
240 return ebookFileUrl != null || (audioFileUrls != null && audioFileUrls.size() > 0);
243 public boolean isLiked() { return liked; }
245 public void setLiked(boolean liked) { this.liked = liked; }