[LIB-8] Add Event Rounds and Seedings functional
[snooker-score-api.git] / src / main / java / org / hedgecode / snooker / json / JsonRound.java
1 /*
2  * Copyright (c) 2017-2019. Developed by Hedgecode.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.hedgecode.snooker.json;
18
19 import com.google.gson.annotations.Expose;
20 import com.google.gson.annotations.SerializedName;
21
22 import org.hedgecode.snooker.api.Event;
23 import org.hedgecode.snooker.api.Round;
24
25 /**
26  * Round Entity to JSON deserialize.
27  *
28  * @author Dmitry Samoshin aka gotty
29  */
30 public class JsonRound extends JsonIdEntity implements Round {
31
32     @SerializedName("Round")
33     private int round;
34     @SerializedName("RoundName")
35     private String roundName;
36     @SerializedName("EventID")
37     private int eventId;
38     @Expose
39     private Event event;
40     @SerializedName("MainEvent")
41     private int mainEventId;
42     @Expose
43     private Event mainEvent;
44     @SerializedName("Distance")
45     private int distance;
46     @SerializedName("NumLeft")
47     private int numLeft;
48     @SerializedName("NumMatches")
49     private int numMatches;
50     @SerializedName("Note")
51     private String note;
52     @SerializedName("ValueType")
53     private String valueType;
54     @SerializedName("Rank")
55     private int rank;
56     @SerializedName("Money")
57     private long money;
58     @SerializedName("SeedGetsHalf")
59     private int seedGetsHalf;
60     @SerializedName("ActualMoney")
61     private long actualMoney;
62     @SerializedName("Currency")
63     private String currency;
64     @SerializedName("ConversionRate")
65     private int conversionRate;
66     @SerializedName("Points")
67     private int points;
68     @SerializedName("SeedPoints")
69     private int seedPoints;
70
71     protected JsonRound() {
72     }
73
74     @Override
75     public int round() {
76         return round;
77     }
78
79     @Override
80     public String roundName() {
81         return roundName;
82     }
83
84     @Override
85     public int eventId() {
86         return eventId;
87     }
88
89     @Override
90     public Event event() {
91         return event;
92     }
93
94     public void setEvent(Event event) {
95         if (event != null && eventId == event.eventId())
96             this.event = event;
97     }
98
99     @Override
100     public int mainEventId() {
101         return mainEventId;
102     }
103
104     @Override
105     public Event mainEvent() {
106         return mainEvent;
107     }
108
109     public void setMainEvent(Event mainEvent) {
110         if (mainEvent != null && mainEventId == mainEvent.eventId())
111             this.mainEvent = mainEvent;
112     }
113
114     @Override
115     public int distance() {
116         return distance;
117     }
118
119     @Override
120     public int numLeft() {
121         return numLeft;
122     }
123
124     @Override
125     public int numMatches() {
126         return numMatches;
127     }
128
129     @Override
130     public String note() {
131         return note;
132     }
133
134     @Override
135     public String valueType() {
136         return valueType;
137     }
138
139     @Override
140     public int rank() {
141         return rank;
142     }
143
144     @Override
145     public long money() {
146         return money;
147     }
148
149     @Override
150     public int seedGetsHalf() {
151         return seedGetsHalf;
152     }
153
154     @Override
155     public long actualMoney() {
156         return actualMoney;
157     }
158
159     @Override
160     public String currency() {
161         return currency;
162     }
163
164     @Override
165     public int conversionRate() {
166         return conversionRate;
167     }
168
169     @Override
170     public int points() {
171         return points;
172     }
173
174     @Override
175     public int seedPoints() {
176         return seedPoints;
177     }
178
179     @Override
180     public int getId() {
181         return round;
182     }
183
184 }