2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.sleepiq.internal.api.dto;
15 import com.google.gson.annotations.SerializedName;
18 * The {@link BedSideStatus} holds the BedSideStatus response from the sleepiq API.
20 * @author Gregory Moyer - Initial contribution
22 public class BedSideStatus {
23 @SerializedName("isInBed")
24 private Boolean inBed;
25 private String alertDetailedMessage;
26 private Integer sleepNumber;
28 private TimeSince lastLink;
29 private Integer pressure; // appears to be in kPa
31 public Boolean isInBed() {
35 public void setInBed(Boolean inBed) {
39 public BedSideStatus withInBed(Boolean inBed) {
44 public String getAlertDetailedMessage() {
45 return alertDetailedMessage;
48 public void setAlertDetailedMessage(String alertDetailedMessage) {
49 this.alertDetailedMessage = alertDetailedMessage;
52 public BedSideStatus withAlertDetailedMessage(String alertDetailedMessage) {
53 setAlertDetailedMessage(alertDetailedMessage);
57 public Integer getSleepNumber() {
61 public void setSleepNumber(Integer sleepNumber) {
62 this.sleepNumber = sleepNumber;
65 public BedSideStatus withSleepNumber(Integer sleepNumber) {
66 setSleepNumber(sleepNumber);
70 public Long getAlertId() {
74 public void setAlertId(Long alertId) {
75 this.alertId = alertId;
78 public BedSideStatus withAlertId(Long alertId) {
83 public TimeSince getLastLink() {
87 public void setLastLink(TimeSince lastLink) {
88 this.lastLink = lastLink;
91 public BedSideStatus withLastLink(TimeSince lastLink) {
92 setLastLink(lastLink);
96 public Integer getPressure() {
100 public void setPressure(Integer pressure) {
101 this.pressure = pressure;
104 public BedSideStatus withPressure(Integer pressure) {
105 setPressure(pressure);
110 public int hashCode() {
111 final int prime = 31;
113 result = prime * result + ((alertDetailedMessage == null) ? 0 : alertDetailedMessage.hashCode());
114 result = prime * result + ((alertId == null) ? 0 : alertId.hashCode());
115 result = prime * result + ((inBed == null) ? 0 : inBed.hashCode());
116 result = prime * result + ((lastLink == null) ? 0 : lastLink.hashCode());
117 result = prime * result + ((pressure == null) ? 0 : pressure.hashCode());
118 result = prime * result + ((sleepNumber == null) ? 0 : sleepNumber.hashCode());
123 public boolean equals(Object obj) {
130 if (!(obj instanceof BedSideStatus)) {
133 BedSideStatus other = (BedSideStatus) obj;
134 if (alertDetailedMessage == null) {
135 if (other.alertDetailedMessage != null) {
138 } else if (!alertDetailedMessage.equals(other.alertDetailedMessage)) {
141 if (alertId == null) {
142 if (other.alertId != null) {
145 } else if (!alertId.equals(other.alertId)) {
149 if (other.inBed != null) {
152 } else if (!inBed.equals(other.inBed)) {
155 if (lastLink == null) {
156 if (other.lastLink != null) {
159 } else if (!lastLink.equals(other.lastLink)) {
162 if (pressure == null) {
163 if (other.pressure != null) {
166 } else if (!pressure.equals(other.pressure)) {
169 if (sleepNumber == null) {
170 if (other.sleepNumber != null) {
173 } else if (!sleepNumber.equals(other.sleepNumber)) {
180 public String toString() {
181 StringBuilder builder = new StringBuilder();
182 builder.append("BedSideStatus [inBed=");
183 builder.append(inBed);
184 builder.append(", alertDetailedMessage=");
185 builder.append(alertDetailedMessage);
186 builder.append(", sleepNumber=");
187 builder.append(sleepNumber);
188 builder.append(", alertId=");
189 builder.append(alertId);
190 builder.append(", lastLink=");
191 builder.append(lastLink);
192 builder.append(", pressure=");
193 builder.append(pressure);
195 return builder.toString();