[LIB-8] Add Event Rounds and Seedings functional
[snooker-score-api.git] / src / main / java / org / hedgecode / snooker / json / JsonRound.java
diff --git a/src/main/java/org/hedgecode/snooker/json/JsonRound.java b/src/main/java/org/hedgecode/snooker/json/JsonRound.java
new file mode 100644 (file)
index 0000000..7dbb3b1
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2017-2019. Developed by Hedgecode.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.hedgecode.snooker.json;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+import org.hedgecode.snooker.api.Event;
+import org.hedgecode.snooker.api.Round;
+
+/**
+ * Round Entity to JSON deserialize.
+ *
+ * @author Dmitry Samoshin aka gotty
+ */
+public class JsonRound extends JsonIdEntity implements Round {
+
+    @SerializedName("Round")
+    private int round;
+    @SerializedName("RoundName")
+    private String roundName;
+    @SerializedName("EventID")
+    private int eventId;
+    @Expose
+    private Event event;
+    @SerializedName("MainEvent")
+    private int mainEventId;
+    @Expose
+    private Event mainEvent;
+    @SerializedName("Distance")
+    private int distance;
+    @SerializedName("NumLeft")
+    private int numLeft;
+    @SerializedName("NumMatches")
+    private int numMatches;
+    @SerializedName("Note")
+    private String note;
+    @SerializedName("ValueType")
+    private String valueType;
+    @SerializedName("Rank")
+    private int rank;
+    @SerializedName("Money")
+    private long money;
+    @SerializedName("SeedGetsHalf")
+    private int seedGetsHalf;
+    @SerializedName("ActualMoney")
+    private long actualMoney;
+    @SerializedName("Currency")
+    private String currency;
+    @SerializedName("ConversionRate")
+    private int conversionRate;
+    @SerializedName("Points")
+    private int points;
+    @SerializedName("SeedPoints")
+    private int seedPoints;
+
+    protected JsonRound() {
+    }
+
+    @Override
+    public int round() {
+        return round;
+    }
+
+    @Override
+    public String roundName() {
+        return roundName;
+    }
+
+    @Override
+    public int eventId() {
+        return eventId;
+    }
+
+    @Override
+    public Event event() {
+        return event;
+    }
+
+    public void setEvent(Event event) {
+        if (event != null && eventId == event.eventId())
+            this.event = event;
+    }
+
+    @Override
+    public int mainEventId() {
+        return mainEventId;
+    }
+
+    @Override
+    public Event mainEvent() {
+        return mainEvent;
+    }
+
+    public void setMainEvent(Event mainEvent) {
+        if (mainEvent != null && mainEventId == mainEvent.eventId())
+            this.mainEvent = mainEvent;
+    }
+
+    @Override
+    public int distance() {
+        return distance;
+    }
+
+    @Override
+    public int numLeft() {
+        return numLeft;
+    }
+
+    @Override
+    public int numMatches() {
+        return numMatches;
+    }
+
+    @Override
+    public String note() {
+        return note;
+    }
+
+    @Override
+    public String valueType() {
+        return valueType;
+    }
+
+    @Override
+    public int rank() {
+        return rank;
+    }
+
+    @Override
+    public long money() {
+        return money;
+    }
+
+    @Override
+    public int seedGetsHalf() {
+        return seedGetsHalf;
+    }
+
+    @Override
+    public long actualMoney() {
+        return actualMoney;
+    }
+
+    @Override
+    public String currency() {
+        return currency;
+    }
+
+    @Override
+    public int conversionRate() {
+        return conversionRate;
+    }
+
+    @Override
+    public int points() {
+        return points;
+    }
+
+    @Override
+    public int seedPoints() {
+        return seedPoints;
+    }
+
+    @Override
+    public int getId() {
+        return round;
+    }
+
+}