Added Android code
[wl-app.git] / Android / app / src / main / java / com / moiseum / wolnelektury / connection / models / ReadingStateModel.java
1 package com.moiseum.wolnelektury.connection.models;
2
3 import com.google.gson.annotations.SerializedName;
4
5 /**
6  * Created by Piotr Ostrowski on 23.06.2018.
7  */
8 public class ReadingStateModel {
9
10         private static final String UNKNOWN = "unknown";
11         private static final String NOT_STARTED = "not_started";
12         private static final String READING = "reading";
13         private static final String COMPLETED = "complete";
14
15         public enum ReadingState {
16                 @SerializedName(UNKNOWN)
17                 STATE_UNKNOWN {
18                         @Override
19                         public String getStateName() {
20                                 return UNKNOWN;
21                         }
22                 },
23                 @SerializedName(NOT_STARTED)
24                 STATE_NOT_STARTED {
25                         @Override
26                         public String getStateName() {
27                                 return NOT_STARTED;
28                         }
29                 },
30                 @SerializedName(READING)
31                 STATE_READING {
32                         @Override
33                         public String getStateName() {
34                                 return READING;
35                         }
36                 },
37                 @SerializedName(COMPLETED)
38                 STATE_COMPLETED {
39                         @Override
40                         public String getStateName() {
41                                 return COMPLETED;
42                         }
43                 };
44
45                 public abstract String getStateName();
46         }
47
48         private ReadingState state;
49
50         public ReadingStateModel() {
51                 this.state = ReadingState.STATE_UNKNOWN;
52         }
53
54         public ReadingState getState() {
55                 return state;
56         }
57
58         public void setState(ReadingState state) {
59                 this.state = state;
60         }
61 }