]> git.basschouten.com Git - openhab-addons.git/blob
d10b6c4e636ffd05a7fb3d422e9bfe057cafc03d
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.sleepiq.internal.api.dto;
14
15 import org.openhab.binding.sleepiq.internal.api.enums.Side;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * The {@link Sleeper} holds the information about the sleeper that's
21  * associated with a bed side.
22  *
23  * @author Gregory Moyer - Initial contribution
24  */
25 public class Sleeper {
26     private String firstName;
27     private Boolean active;
28     private Boolean emailValidated;
29     @SerializedName("isChild")
30     private Boolean child;
31     private String bedId;
32     private String birthYear;
33     private String zipCode;
34     private String timezone;
35     @SerializedName("isMale")
36     private Boolean male;
37     private Integer weight; // lbs
38     private String duration;
39     private String sleeperId;
40     private Integer height; // inches
41     private Long licenseVersion;
42     private String username;
43     private Integer birthMonth; // 0-based; 12 means not entered?
44     private Integer sleepGoal;
45     @SerializedName("isAccountOwner")
46     private Boolean accountOwner;
47     private String accountId;
48     private String email;
49     private String avatar;
50     private String lastLogin; // should be ZonedDateTime but provider passes string "null" when missing
51     private Side side; // 0=left; 1=right
52
53     public String getFirstName() {
54         return firstName;
55     }
56
57     public void setFirstName(String firstName) {
58         this.firstName = firstName;
59     }
60
61     public Sleeper withFirstName(String firstName) {
62         setFirstName(firstName);
63         return this;
64     }
65
66     public Boolean isActive() {
67         return active;
68     }
69
70     public void setActive(Boolean active) {
71         this.active = active;
72     }
73
74     public Sleeper withActive(Boolean active) {
75         setActive(active);
76         return this;
77     }
78
79     public Boolean isEmailValidated() {
80         return emailValidated;
81     }
82
83     public void setEmailValidated(Boolean emailValidated) {
84         this.emailValidated = emailValidated;
85     }
86
87     public Sleeper withEmailValidated(Boolean emailValidated) {
88         setEmailValidated(emailValidated);
89         return this;
90     }
91
92     public Boolean isChild() {
93         return child;
94     }
95
96     public void setChild(Boolean child) {
97         this.child = child;
98     }
99
100     public Sleeper withChild(Boolean child) {
101         setChild(child);
102         return this;
103     }
104
105     public String getBedId() {
106         return bedId;
107     }
108
109     public void setBedId(String bedId) {
110         this.bedId = bedId;
111     }
112
113     public Sleeper withBedId(String bedId) {
114         setBedId(bedId);
115         return this;
116     }
117
118     public String getBirthYear() {
119         return birthYear;
120     }
121
122     public void setBirthYear(String birthYear) {
123         this.birthYear = birthYear;
124     }
125
126     public Sleeper withBirthYear(String birthYear) {
127         setBirthYear(birthYear);
128         return this;
129     }
130
131     public String getZipCode() {
132         return zipCode;
133     }
134
135     public void setZipCode(String zipCode) {
136         this.zipCode = zipCode;
137     }
138
139     public Sleeper withZipCode(String zipCode) {
140         setZipCode(zipCode);
141         return this;
142     }
143
144     public String getTimezone() {
145         return timezone;
146     }
147
148     public void setTimezone(String timezone) {
149         this.timezone = timezone;
150     }
151
152     public Sleeper withTimezone(String timezone) {
153         setTimezone(timezone);
154         return this;
155     }
156
157     public Boolean isMale() {
158         return male;
159     }
160
161     public void setMale(Boolean male) {
162         this.male = male;
163     }
164
165     public Sleeper withMale(Boolean male) {
166         setMale(male);
167         return this;
168     }
169
170     public Integer getWeight() {
171         return weight;
172     }
173
174     public void setWeight(Integer weight) {
175         this.weight = weight;
176     }
177
178     public Sleeper withWeight(Integer weight) {
179         setWeight(weight);
180         return this;
181     }
182
183     public String getDuration() {
184         return duration;
185     }
186
187     public void setDuration(String duration) {
188         this.duration = duration;
189     }
190
191     public Sleeper withDuration(String duration) {
192         setDuration(duration);
193         return this;
194     }
195
196     public String getSleeperId() {
197         return sleeperId;
198     }
199
200     public void setSleeperId(String sleeperId) {
201         this.sleeperId = sleeperId;
202     }
203
204     public Sleeper withSleeperId(String sleeperId) {
205         setSleeperId(sleeperId);
206         return this;
207     }
208
209     public Integer getHeight() {
210         return height;
211     }
212
213     public void setHeight(Integer height) {
214         this.height = height;
215     }
216
217     public Sleeper withHeight(Integer height) {
218         setHeight(height);
219         return this;
220     }
221
222     public Long getLicenseVersion() {
223         return licenseVersion;
224     }
225
226     public void setLicenseVersion(Long licenseVersion) {
227         this.licenseVersion = licenseVersion;
228     }
229
230     public Sleeper withLicenseVersion(Long licenseVersion) {
231         setLicenseVersion(licenseVersion);
232         return this;
233     }
234
235     public String getUsername() {
236         return username;
237     }
238
239     public void setUsername(String username) {
240         this.username = username;
241     }
242
243     public Sleeper withUsername(String username) {
244         setUsername(username);
245         return this;
246     }
247
248     public Integer getBirthMonth() {
249         return birthMonth;
250     }
251
252     public void setBirthMonth(Integer birthMonth) {
253         this.birthMonth = birthMonth;
254     }
255
256     public Sleeper withBirthMonth(Integer birthMonth) {
257         setBirthMonth(birthMonth);
258         return this;
259     }
260
261     public Integer getSleepGoal() {
262         return sleepGoal;
263     }
264
265     public void setSleepGoal(Integer sleepGoal) {
266         this.sleepGoal = sleepGoal;
267     }
268
269     public Sleeper withSleepGoal(Integer sleepGoal) {
270         setSleepGoal(sleepGoal);
271         return this;
272     }
273
274     public Boolean isAccountOwner() {
275         return accountOwner;
276     }
277
278     public void setAccountOwner(Boolean accountOwner) {
279         this.accountOwner = accountOwner;
280     }
281
282     public Sleeper withAccountOwner(Boolean accountOwner) {
283         setAccountOwner(accountOwner);
284         return this;
285     }
286
287     public String getAccountId() {
288         return accountId;
289     }
290
291     public void setAccountId(String accountId) {
292         this.accountId = accountId;
293     }
294
295     public Sleeper withAccountId(String accountId) {
296         setAccountId(accountId);
297         return this;
298     }
299
300     public String getEmail() {
301         return email;
302     }
303
304     public void setEmail(String email) {
305         this.email = email;
306     }
307
308     public Sleeper withEmail(String email) {
309         setEmail(email);
310         return this;
311     }
312
313     public String getAvatar() {
314         return avatar;
315     }
316
317     public void setAvatar(String avatar) {
318         this.avatar = avatar;
319     }
320
321     public Sleeper withAvatar(String avatar) {
322         setAvatar(avatar);
323         return this;
324     }
325
326     public String getLastLogin() {
327         return lastLogin;
328     }
329
330     public void setLastLogin(String lastLogin) {
331         this.lastLogin = lastLogin;
332     }
333
334     public Sleeper withLastLogin(String lastLogin) {
335         setLastLogin(lastLogin);
336         return this;
337     }
338
339     public Side getSide() {
340         return side;
341     }
342
343     public void setSide(Side side) {
344         this.side = side;
345     }
346
347     public Sleeper withSide(Side side) {
348         setSide(side);
349         return this;
350     }
351
352     @Override
353     public int hashCode() {
354         final int prime = 31;
355         int result = 1;
356         result = prime * result + ((sleeperId == null) ? 0 : sleeperId.hashCode());
357         return result;
358     }
359
360     @Override
361     public boolean equals(Object obj) {
362         if (this == obj) {
363             return true;
364         }
365         if (obj == null) {
366             return false;
367         }
368         if (!(obj instanceof Sleeper)) {
369             return false;
370         }
371         Sleeper other = (Sleeper) obj;
372         if (sleeperId == null) {
373             if (other.sleeperId != null) {
374                 return false;
375             }
376         } else if (!sleeperId.equals(other.sleeperId)) {
377             return false;
378         }
379         return true;
380     }
381
382     @Override
383     public String toString() {
384         StringBuilder builder = new StringBuilder();
385         builder.append("Sleeper [firstName=");
386         builder.append(firstName);
387         builder.append(", active=");
388         builder.append(active);
389         builder.append(", emailValidated=");
390         builder.append(emailValidated);
391         builder.append(", child=");
392         builder.append(child);
393         builder.append(", bedId=");
394         builder.append(bedId);
395         builder.append(", birthYear=");
396         builder.append(birthYear);
397         builder.append(", zipCode=");
398         builder.append(zipCode);
399         builder.append(", timezone=");
400         builder.append(timezone);
401         builder.append(", male=");
402         builder.append(male);
403         builder.append(", weight=");
404         builder.append(weight);
405         builder.append(", duration=");
406         builder.append(duration);
407         builder.append(", sleeperId=");
408         builder.append(sleeperId);
409         builder.append(", height=");
410         builder.append(height);
411         builder.append(", licenseVersion=");
412         builder.append(licenseVersion);
413         builder.append(", username=");
414         builder.append(username);
415         builder.append(", birthMonth=");
416         builder.append(birthMonth);
417         builder.append(", sleepGoal=");
418         builder.append(sleepGoal);
419         builder.append(", accountOwner=");
420         builder.append(accountOwner);
421         builder.append(", accountId=");
422         builder.append(accountId);
423         builder.append(", email=");
424         builder.append(email);
425         builder.append(", avatar=");
426         builder.append(avatar);
427         builder.append(", lastLogin=");
428         builder.append(lastLogin);
429         builder.append(", side=");
430         builder.append(side);
431         builder.append("]");
432         return builder.toString();
433     }
434 }