2 * Copyright (c) 2017. Developed by Hedgecode.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.hedgecode.snooker.json;
19 import java.util.Date;
21 import com.google.gson.annotations.Expose;
22 import com.google.gson.annotations.SerializedName;
24 import org.hedgecode.snooker.api.Event;
25 import org.hedgecode.snooker.api.Season;
28 * Event Entity to JSON deserialize.
30 * @author Dmitry Samoshin aka gotty
32 public class JsonEvent extends JsonIdEntity implements Event {
36 @SerializedName("Name")
38 @SerializedName("StartDate")
39 private Date startDate;
40 @SerializedName("EndDate")
42 @SerializedName("Sponsor")
43 private String sponsor;
44 @SerializedName("Season")
45 private int seasonYear;
47 private Season season;
48 @SerializedName("Type")
50 @SerializedName("Num")
52 @SerializedName("Venue")
54 @SerializedName("City")
56 @SerializedName("Country")
57 private String country;
58 @SerializedName("Discipline")
59 private String discipline;
60 @SerializedName("Main")
61 private int mainEventId;
63 private Event mainEvent;
64 @SerializedName("Sex")
66 @SerializedName("AgeGroup")
67 private String ageGroup;
68 @SerializedName("Url")
70 @SerializedName("Related")
71 private String related;
72 @SerializedName("Stage")
74 @SerializedName("ValueType")
75 private String valueType;
76 @SerializedName("ShortName")
77 private String shortName;
78 @SerializedName("WorldSnookerId")
79 private int worldSnookerId;
80 @SerializedName("RankingType")
81 private String rankingType;
82 @SerializedName("EventPredictionID")
83 private int eventPredictionId;
84 @SerializedName("Team")
86 @SerializedName("Format")
88 @SerializedName("Twitter")
89 private String twitter;
90 @SerializedName("HashTag")
91 private String hashTag;
92 @SerializedName("ConversionRate")
93 private float conversionRate;
94 @SerializedName("AllRoundsAdded")
95 private boolean allRoundsAdded;
96 @SerializedName("PhotoURLs")
97 private String photoUrls;
98 @SerializedName("NumCompetitors")
99 private int numCompetitors;
100 @SerializedName("NumUpcoming")
101 private int numUpcoming;
102 @SerializedName("NumActive")
103 private int numActive;
104 @SerializedName("NumResults")
105 private int numResults;
106 @SerializedName("Note")
108 @SerializedName("CommonNote")
109 private String commonNote;
110 @SerializedName("DefendingChampion")
111 private int defendingChampion;
112 @SerializedName("PreviousEdition")
113 private int previousEdition;
115 protected JsonEvent() {
119 public int eventId() {
124 public String name() {
129 public Date startDate() {
130 return startDate == null
132 : new Date(startDate.getTime());
136 public Date endDate() {
137 return endDate == null
139 : new Date(endDate.getTime());
143 public String sponsor() {
148 public Season season() {
150 season = Season.getSeason(seasonYear);
155 public String type() {
165 public String venue() {
170 public String city() {
175 public String country() {
180 public String discipline() {
185 public int mainEventId() {
190 public Event mainEvent() {
191 if (mainEvent == null && mainEventId == eventId)
196 public void setMainEvent(Event event) {
197 if (event != null && eventId == event.eventId())
202 public String sex() {
207 public String ageGroup() {
212 public String url() {
217 public String related() {
222 public String stage() {
227 public String valueType() {
232 public String shortName() {
237 public int worldSnookerId() {
238 return worldSnookerId;
242 public String rankingType() {
247 public int eventPredictionId() {
248 return eventPredictionId;
252 public boolean team() {
257 public int format() {
262 public String twitter() {
267 public String hashTag() {
272 public float conversionRate() {
273 return conversionRate;
277 public boolean allRoundsAdded() {
278 return allRoundsAdded;
282 public String photoUrls() {
287 public int numCompetitors() {
288 return numCompetitors;
292 public int numUpcoming() {
297 public int numActive() {
302 public int numResults() {
307 public String note() {
312 public String commonNote() {
317 public int defendingChampion() {
318 return defendingChampion;
322 public int previousEdition() {
323 return previousEdition;