2 * Copyright 2017 Gregory Moyer
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.openhab.binding.sleepiq.api.model;
18 import com.google.gson.annotations.SerializedName;
22 private String firstName;
23 private Boolean active;
24 private Boolean emailValidated;
25 @SerializedName("isChild")
26 private Boolean child;
28 private String birthYear;
29 private String zipCode;
30 private String timezone;
31 @SerializedName("isMale")
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;
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
49 public String getFirstName()
54 public void setFirstName(String firstName)
56 this.firstName = firstName;
59 public Sleeper withFirstName(String firstName)
61 setFirstName(firstName);
65 public Boolean isActive()
70 public void setActive(Boolean active)
75 public Sleeper withActive(Boolean active)
81 public Boolean isEmailValidated()
83 return emailValidated;
86 public void setEmailValidated(Boolean emailValidated)
88 this.emailValidated = emailValidated;
91 public Sleeper withEmailValidated(Boolean emailValidated)
93 setEmailValidated(emailValidated);
97 public Boolean isChild()
102 public void setChild(Boolean child)
107 public Sleeper withChild(Boolean child)
113 public String getBedId()
118 public void setBedId(String bedId)
123 public Sleeper withBedId(String bedId)
129 public String getBirthYear()
134 public void setBirthYear(String birthYear)
136 this.birthYear = birthYear;
139 public Sleeper withBirthYear(String birthYear)
141 setBirthYear(birthYear);
145 public String getZipCode()
150 public void setZipCode(String zipCode)
152 this.zipCode = zipCode;
155 public Sleeper withZipCode(String zipCode)
161 public String getTimezone()
166 public void setTimezone(String timezone)
168 this.timezone = timezone;
171 public Sleeper withTimezone(String timezone)
173 setTimezone(timezone);
177 public Boolean isMale()
182 public void setMale(Boolean male)
187 public Sleeper withMale(Boolean male)
193 public Integer getWeight()
198 public void setWeight(Integer weight)
200 this.weight = weight;
203 public Sleeper withWeight(Integer weight)
209 public String getDuration()
214 public void setDuration(String duration)
216 this.duration = duration;
219 public Sleeper withDuration(String duration)
221 setDuration(duration);
225 public String getSleeperId()
230 public void setSleeperId(String sleeperId)
232 this.sleeperId = sleeperId;
235 public Sleeper withSleeperId(String sleeperId)
237 setSleeperId(sleeperId);
241 public Integer getHeight()
246 public void setHeight(Integer height)
248 this.height = height;
251 public Sleeper withHeight(Integer height)
257 public Long getLicenseVersion()
259 return licenseVersion;
262 public void setLicenseVersion(Long licenseVersion)
264 this.licenseVersion = licenseVersion;
267 public Sleeper withLicenseVersion(Long licenseVersion)
269 setLicenseVersion(licenseVersion);
273 public String getUsername()
278 public void setUsername(String username)
280 this.username = username;
283 public Sleeper withUsername(String username)
285 setUsername(username);
289 public Integer getBirthMonth()
294 public void setBirthMonth(Integer birthMonth)
296 this.birthMonth = birthMonth;
299 public Sleeper withBirthMonth(Integer birthMonth)
301 setBirthMonth(birthMonth);
305 public Integer getSleepGoal()
310 public void setSleepGoal(Integer sleepGoal)
312 this.sleepGoal = sleepGoal;
315 public Sleeper withSleepGoal(Integer sleepGoal)
317 setSleepGoal(sleepGoal);
321 public Boolean isAccountOwner()
326 public void setAccountOwner(Boolean accountOwner)
328 this.accountOwner = accountOwner;
331 public Sleeper withAccountOwner(Boolean accountOwner)
333 setAccountOwner(accountOwner);
337 public String getAccountId()
342 public void setAccountId(String accountId)
344 this.accountId = accountId;
347 public Sleeper withAccountId(String accountId)
349 setAccountId(accountId);
353 public String getEmail()
358 public void setEmail(String email)
363 public Sleeper withEmail(String email)
369 public String getAvatar()
374 public void setAvatar(String avatar)
376 this.avatar = avatar;
379 public Sleeper withAvatar(String avatar)
385 public String getLastLogin()
390 public void setLastLogin(String lastLogin)
392 this.lastLogin = lastLogin;
395 public Sleeper withLastLogin(String lastLogin)
397 setLastLogin(lastLogin);
401 public Integer getSide()
406 public void setSide(Integer side)
411 public Sleeper withSide(Integer side)
418 public int hashCode()
420 final int prime = 31;
422 result = prime * result + ((sleeperId == null) ? 0 : sleeperId.hashCode());
427 public boolean equals(Object obj)
437 if (!(obj instanceof Sleeper))
441 Sleeper other = (Sleeper)obj;
442 if (sleeperId == null)
444 if (other.sleeperId != null)
449 else if (!sleeperId.equals(other.sleeperId))
457 public String toString()
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);
507 return builder.toString();