]> git.basschouten.com Git - openhab-addons.git/blob
8a9ff0adfce52d3e64148d46185c88bf8091e7ca
[openhab-addons.git] /
1 /*
2  * Copyright 2017 Gregory Moyer
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 package org.openhab.binding.sleepiq.api.model;
17
18 import com.google.gson.annotations.SerializedName;
19
20 public class Sleeper
21 {
22     private String firstName;
23     private Boolean active;
24     private Boolean emailValidated;
25     @SerializedName("isChild")
26     private Boolean child;
27     private String bedId;
28     private String birthYear;
29     private String zipCode;
30     private String timezone;
31     @SerializedName("isMale")
32     private Boolean male;
33     private Integer weight; // lbs
34     private String duration;
35     private String sleeperId;
36     private Integer height; // inches
37     private Long licenseVersion;
38     private String username;
39     private Integer birthMonth; // 0-based; 12 means not entered?
40     private Integer sleepGoal;
41     @SerializedName("isAccountOwner")
42     private Boolean accountOwner;
43     private String accountId;
44     private String email;
45     private String avatar;
46     private String lastLogin; // should be ZonedDateTime but provider passes string "null" when missing
47     private Integer side; // 0=left; 1=right
48
49     public String getFirstName()
50     {
51         return firstName;
52     }
53
54     public void setFirstName(String firstName)
55     {
56         this.firstName = firstName;
57     }
58
59     public Sleeper withFirstName(String firstName)
60     {
61         setFirstName(firstName);
62         return this;
63     }
64
65     public Boolean isActive()
66     {
67         return active;
68     }
69
70     public void setActive(Boolean active)
71     {
72         this.active = active;
73     }
74
75     public Sleeper withActive(Boolean active)
76     {
77         setActive(active);
78         return this;
79     }
80
81     public Boolean isEmailValidated()
82     {
83         return emailValidated;
84     }
85
86     public void setEmailValidated(Boolean emailValidated)
87     {
88         this.emailValidated = emailValidated;
89     }
90
91     public Sleeper withEmailValidated(Boolean emailValidated)
92     {
93         setEmailValidated(emailValidated);
94         return this;
95     }
96
97     public Boolean isChild()
98     {
99         return child;
100     }
101
102     public void setChild(Boolean child)
103     {
104         this.child = child;
105     }
106
107     public Sleeper withChild(Boolean child)
108     {
109         setChild(child);
110         return this;
111     }
112
113     public String getBedId()
114     {
115         return bedId;
116     }
117
118     public void setBedId(String bedId)
119     {
120         this.bedId = bedId;
121     }
122
123     public Sleeper withBedId(String bedId)
124     {
125         setBedId(bedId);
126         return this;
127     }
128
129     public String getBirthYear()
130     {
131         return birthYear;
132     }
133
134     public void setBirthYear(String birthYear)
135     {
136         this.birthYear = birthYear;
137     }
138
139     public Sleeper withBirthYear(String birthYear)
140     {
141         setBirthYear(birthYear);
142         return this;
143     }
144
145     public String getZipCode()
146     {
147         return zipCode;
148     }
149
150     public void setZipCode(String zipCode)
151     {
152         this.zipCode = zipCode;
153     }
154
155     public Sleeper withZipCode(String zipCode)
156     {
157         setZipCode(zipCode);
158         return this;
159     }
160
161     public String getTimezone()
162     {
163         return timezone;
164     }
165
166     public void setTimezone(String timezone)
167     {
168         this.timezone = timezone;
169     }
170
171     public Sleeper withTimezone(String timezone)
172     {
173         setTimezone(timezone);
174         return this;
175     }
176
177     public Boolean isMale()
178     {
179         return male;
180     }
181
182     public void setMale(Boolean male)
183     {
184         this.male = male;
185     }
186
187     public Sleeper withMale(Boolean male)
188     {
189         setMale(male);
190         return this;
191     }
192
193     public Integer getWeight()
194     {
195         return weight;
196     }
197
198     public void setWeight(Integer weight)
199     {
200         this.weight = weight;
201     }
202
203     public Sleeper withWeight(Integer weight)
204     {
205         setWeight(weight);
206         return this;
207     }
208
209     public String getDuration()
210     {
211         return duration;
212     }
213
214     public void setDuration(String duration)
215     {
216         this.duration = duration;
217     }
218
219     public Sleeper withDuration(String duration)
220     {
221         setDuration(duration);
222         return this;
223     }
224
225     public String getSleeperId()
226     {
227         return sleeperId;
228     }
229
230     public void setSleeperId(String sleeperId)
231     {
232         this.sleeperId = sleeperId;
233     }
234
235     public Sleeper withSleeperId(String sleeperId)
236     {
237         setSleeperId(sleeperId);
238         return this;
239     }
240
241     public Integer getHeight()
242     {
243         return height;
244     }
245
246     public void setHeight(Integer height)
247     {
248         this.height = height;
249     }
250
251     public Sleeper withHeight(Integer height)
252     {
253         setHeight(height);
254         return this;
255     }
256
257     public Long getLicenseVersion()
258     {
259         return licenseVersion;
260     }
261
262     public void setLicenseVersion(Long licenseVersion)
263     {
264         this.licenseVersion = licenseVersion;
265     }
266
267     public Sleeper withLicenseVersion(Long licenseVersion)
268     {
269         setLicenseVersion(licenseVersion);
270         return this;
271     }
272
273     public String getUsername()
274     {
275         return username;
276     }
277
278     public void setUsername(String username)
279     {
280         this.username = username;
281     }
282
283     public Sleeper withUsername(String username)
284     {
285         setUsername(username);
286         return this;
287     }
288
289     public Integer getBirthMonth()
290     {
291         return birthMonth;
292     }
293
294     public void setBirthMonth(Integer birthMonth)
295     {
296         this.birthMonth = birthMonth;
297     }
298
299     public Sleeper withBirthMonth(Integer birthMonth)
300     {
301         setBirthMonth(birthMonth);
302         return this;
303     }
304
305     public Integer getSleepGoal()
306     {
307         return sleepGoal;
308     }
309
310     public void setSleepGoal(Integer sleepGoal)
311     {
312         this.sleepGoal = sleepGoal;
313     }
314
315     public Sleeper withSleepGoal(Integer sleepGoal)
316     {
317         setSleepGoal(sleepGoal);
318         return this;
319     }
320
321     public Boolean isAccountOwner()
322     {
323         return accountOwner;
324     }
325
326     public void setAccountOwner(Boolean accountOwner)
327     {
328         this.accountOwner = accountOwner;
329     }
330
331     public Sleeper withAccountOwner(Boolean accountOwner)
332     {
333         setAccountOwner(accountOwner);
334         return this;
335     }
336
337     public String getAccountId()
338     {
339         return accountId;
340     }
341
342     public void setAccountId(String accountId)
343     {
344         this.accountId = accountId;
345     }
346
347     public Sleeper withAccountId(String accountId)
348     {
349         setAccountId(accountId);
350         return this;
351     }
352
353     public String getEmail()
354     {
355         return email;
356     }
357
358     public void setEmail(String email)
359     {
360         this.email = email;
361     }
362
363     public Sleeper withEmail(String email)
364     {
365         setEmail(email);
366         return this;
367     }
368
369     public String getAvatar()
370     {
371         return avatar;
372     }
373
374     public void setAvatar(String avatar)
375     {
376         this.avatar = avatar;
377     }
378
379     public Sleeper withAvatar(String avatar)
380     {
381         setAvatar(avatar);
382         return this;
383     }
384
385     public String getLastLogin()
386     {
387         return lastLogin;
388     }
389
390     public void setLastLogin(String lastLogin)
391     {
392         this.lastLogin = lastLogin;
393     }
394
395     public Sleeper withLastLogin(String lastLogin)
396     {
397         setLastLogin(lastLogin);
398         return this;
399     }
400
401     public Integer getSide()
402     {
403         return side;
404     }
405
406     public void setSide(Integer side)
407     {
408         this.side = side;
409     }
410
411     public Sleeper withSide(Integer side)
412     {
413         setSide(side);
414         return this;
415     }
416
417     @Override
418     public int hashCode()
419     {
420         final int prime = 31;
421         int result = 1;
422         result = prime * result + ((sleeperId == null) ? 0 : sleeperId.hashCode());
423         return result;
424     }
425
426     @Override
427     public boolean equals(Object obj)
428     {
429         if (this == obj)
430         {
431             return true;
432         }
433         if (obj == null)
434         {
435             return false;
436         }
437         if (!(obj instanceof Sleeper))
438         {
439             return false;
440         }
441         Sleeper other = (Sleeper)obj;
442         if (sleeperId == null)
443         {
444             if (other.sleeperId != null)
445             {
446                 return false;
447             }
448         }
449         else if (!sleeperId.equals(other.sleeperId))
450         {
451             return false;
452         }
453         return true;
454     }
455
456     @Override
457     public String toString()
458     {
459         StringBuilder builder = new StringBuilder();
460         builder.append("Sleeper [firstName=");
461         builder.append(firstName);
462         builder.append(", active=");
463         builder.append(active);
464         builder.append(", emailValidated=");
465         builder.append(emailValidated);
466         builder.append(", child=");
467         builder.append(child);
468         builder.append(", bedId=");
469         builder.append(bedId);
470         builder.append(", birthYear=");
471         builder.append(birthYear);
472         builder.append(", zipCode=");
473         builder.append(zipCode);
474         builder.append(", timezone=");
475         builder.append(timezone);
476         builder.append(", male=");
477         builder.append(male);
478         builder.append(", weight=");
479         builder.append(weight);
480         builder.append(", duration=");
481         builder.append(duration);
482         builder.append(", sleeperId=");
483         builder.append(sleeperId);
484         builder.append(", height=");
485         builder.append(height);
486         builder.append(", licenseVersion=");
487         builder.append(licenseVersion);
488         builder.append(", username=");
489         builder.append(username);
490         builder.append(", birthMonth=");
491         builder.append(birthMonth);
492         builder.append(", sleepGoal=");
493         builder.append(sleepGoal);
494         builder.append(", accountOwner=");
495         builder.append(accountOwner);
496         builder.append(", accountId=");
497         builder.append(accountId);
498         builder.append(", email=");
499         builder.append(email);
500         builder.append(", avatar=");
501         builder.append(avatar);
502         builder.append(", lastLogin=");
503         builder.append(lastLogin);
504         builder.append(", side=");
505         builder.append(side);
506         builder.append("]");
507         return builder.toString();
508     }
509 }