@@ -29,7 +29,6 @@ public class Space implements IdentifiableApiResponseModel {
2929 // Immutable
3030 private final int id ;
3131 private final int locationId ;
32- private final boolean isDibsed ;
3332 private final DateTime createdAt ;
3433 private final DateTime updatedAt ;
3534
@@ -43,21 +42,19 @@ public class Space implements IdentifiableApiResponseModel {
4342 private Boolean isDisabled ;
4443
4544 // Submodels
45+ private State state ;
4646 private Location location ;
4747 private Calendar calendar ;
48- private Event currentEvent ;
49- private Event nextEvent ;
5048 private List <Amenity > amenities ;
5149
5250
5351 /**
5452 * Methods
5553 */
5654
57- public Space (int id , int locationId , boolean isDibsed , DateTime createdAt , DateTime updatedAt ) {
55+ public Space (int id , int locationId , DateTime createdAt , DateTime updatedAt ) {
5856 this .id = id ;
5957 this .locationId = locationId ;
60- this .isDibsed = isDibsed ;
6158 this .createdAt = createdAt ;
6259 this .updatedAt = updatedAt ;
6360 }
@@ -127,10 +124,6 @@ public void setType(String type) {
127124 this .type = type ;
128125 }
129126
130- public Boolean isDibsed () {
131- return isDibsed ;
132- }
133-
134127 public DateTime getUpdatedAt () {
135128 return updatedAt ;
136129 }
@@ -139,6 +132,14 @@ public DateTime getCreatedAt() {
139132 return createdAt ;
140133 }
141134
135+ public State getState () {
136+ return state ;
137+ }
138+
139+ public void setState (State state ) {
140+ this .state = state ;
141+ }
142+
142143 public Location getLocation () {
143144 return location ;
144145 }
@@ -155,22 +156,6 @@ public void setCalendar(Calendar calendar) {
155156 this .calendar = calendar ;
156157 }
157158
158- public Event getCurrentEvent () {
159- return currentEvent ;
160- }
161-
162- public void setCurrentEvent (Event currentEvent ) {
163- this .currentEvent = currentEvent ;
164- }
165-
166- public Event getNextEvent () {
167- return nextEvent ;
168- }
169-
170- public void setNextEvent (Event nextEvent ) {
171- this .nextEvent = nextEvent ;
172- }
173-
174159 public List <Amenity > getAmenities () {
175160 return amenities ;
176161 }
@@ -186,14 +171,13 @@ public boolean equals(Object o) {
186171 Space space = (Space ) o ;
187172 return Objects .equal (id , space .id ) &&
188173 Objects .equal (locationId , space .locationId ) &&
189- Objects .equal (isDibsed , space .isDibsed ) &&
190174 Objects .equal (createdAt , space .createdAt ) &&
191175 Objects .equal (updatedAt , space .updatedAt );
192176 }
193177
194178 @ Override
195179 public int hashCode () {
196- return Objects .hashCode (id , locationId , isDibsed , createdAt , updatedAt );
180+ return Objects .hashCode (id , locationId , createdAt , updatedAt );
197181 }
198182
199183 @ Override
@@ -208,13 +192,10 @@ public String toString() {
208192 ", capacity=" + capacity +
209193 ", type=" + type +
210194 ", isDisabled=" + isDisabled +
211- ", isDibsed=" + isDibsed +
212195 ", updatedAt=" + updatedAt +
213196 ", createdAt=" + createdAt +
214197 ", location=" + location +
215198 ", calendar=" + calendar +
216- ", currentEvent=" + currentEvent +
217- ", nextEvent=" + nextEvent +
218199 ", amenities=" + amenities +
219200 '}' ;
220201 }
@@ -223,4 +204,69 @@ public String toString() {
223204 public String getMimeType () {
224205 return MIME_TYPE ;
225206 }
207+
208+ /**
209+ * Represents the current state of the space, containing information about availability and whether there is
210+ * presence.
211+ */
212+ public static class State implements ApiResponseModel {
213+
214+ public static final String MIME_TYPE = "vnd.robinpowered.space.state.v1" ;
215+
216+ public static final String AVAILABLE = "available" ;
217+ public static final String BOOKED = "booked" ;
218+ public static final String IN_USE = "in_use" ;
219+ public static final String DISABLED = "disabled" ;
220+
221+ private final String availability ;
222+ private final int present ;
223+ private final DateTime nextBusyChange ;
224+
225+ public State (String availability , int present , DateTime nextBusyChange ) {
226+ this .availability = availability ;
227+ this .present = present ;
228+ this .nextBusyChange = nextBusyChange ;
229+ }
230+
231+ public String getAvailability () {
232+ return availability ;
233+ }
234+
235+ public int getPresent () {
236+ return present ;
237+ }
238+
239+ public DateTime getNextBusyChange () {
240+ return nextBusyChange ;
241+ }
242+
243+ @ Override
244+ public String getMimeType () {
245+ return MIME_TYPE ;
246+ }
247+
248+ @ Override
249+ public boolean equals (Object o ) {
250+ if (this == o ) return true ;
251+ if (o == null || getClass () != o .getClass ()) return false ;
252+ State state = (State ) o ;
253+ return Objects .equal (present , state .present ) &&
254+ Objects .equal (availability , state .availability ) &&
255+ Objects .equal (nextBusyChange , state .nextBusyChange );
256+ }
257+
258+ @ Override
259+ public int hashCode () {
260+ return Objects .hashCode (availability , present , nextBusyChange );
261+ }
262+
263+ @ Override
264+ public String toString () {
265+ return "State{" +
266+ "availability=" + availability +
267+ ", present=" + present +
268+ ", nextBusyChange=" + nextBusyChange +
269+ '}' ;
270+ }
271+ }
226272}
0 commit comments