@@ -42,6 +42,7 @@ public class Space implements IdentifiableApiResponseModel {
4242 private Boolean isDisabled ;
4343
4444 // Submodels
45+ private State state ;
4546 private Location location ;
4647 private Calendar calendar ;
4748 private List <Amenity > amenities ;
@@ -131,6 +132,14 @@ public DateTime getCreatedAt() {
131132 return createdAt ;
132133 }
133134
135+ public State getState () {
136+ return state ;
137+ }
138+
139+ public void setState (State state ) {
140+ this .state = state ;
141+ }
142+
134143 public Location getLocation () {
135144 return location ;
136145 }
@@ -162,14 +171,13 @@ public boolean equals(Object o) {
162171 Space space = (Space ) o ;
163172 return Objects .equal (id , space .id ) &&
164173 Objects .equal (locationId , space .locationId ) &&
165- Objects .equal (isDibsed , space .isDibsed ) &&
166174 Objects .equal (createdAt , space .createdAt ) &&
167175 Objects .equal (updatedAt , space .updatedAt );
168176 }
169177
170178 @ Override
171179 public int hashCode () {
172- return Objects .hashCode (id , locationId , isDibsed , createdAt , updatedAt );
180+ return Objects .hashCode (id , locationId , createdAt , updatedAt );
173181 }
174182
175183 @ Override
@@ -196,4 +204,69 @@ public String toString() {
196204 public String getMimeType () {
197205 return MIME_TYPE ;
198206 }
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+ }
199272}
0 commit comments