]> git.basschouten.com Git - openhab-addons.git/blob
72844ffa90026aff0e0eee51d7b7d4cf7f7f6b7e
[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 com.google.gson.annotations.SerializedName;
16
17 /**
18  * The {@link BedSideStatus} holds the BedSideStatus response from the sleepiq API.
19  *
20  * @author Gregory Moyer - Initial contribution
21  */
22 public class BedSideStatus {
23     @SerializedName("isInBed")
24     private Boolean inBed;
25     private String alertDetailedMessage;
26     private Integer sleepNumber;
27     private Long alertId;
28     private TimeSince lastLink;
29     private Integer pressure; // appears to be in kPa
30
31     public Boolean isInBed() {
32         return inBed;
33     }
34
35     public void setInBed(Boolean inBed) {
36         this.inBed = inBed;
37     }
38
39     public BedSideStatus withInBed(Boolean inBed) {
40         setInBed(inBed);
41         return this;
42     }
43
44     public String getAlertDetailedMessage() {
45         return alertDetailedMessage;
46     }
47
48     public void setAlertDetailedMessage(String alertDetailedMessage) {
49         this.alertDetailedMessage = alertDetailedMessage;
50     }
51
52     public BedSideStatus withAlertDetailedMessage(String alertDetailedMessage) {
53         setAlertDetailedMessage(alertDetailedMessage);
54         return this;
55     }
56
57     public Integer getSleepNumber() {
58         return sleepNumber;
59     }
60
61     public void setSleepNumber(Integer sleepNumber) {
62         this.sleepNumber = sleepNumber;
63     }
64
65     public BedSideStatus withSleepNumber(Integer sleepNumber) {
66         setSleepNumber(sleepNumber);
67         return this;
68     }
69
70     public Long getAlertId() {
71         return alertId;
72     }
73
74     public void setAlertId(Long alertId) {
75         this.alertId = alertId;
76     }
77
78     public BedSideStatus withAlertId(Long alertId) {
79         setAlertId(alertId);
80         return this;
81     }
82
83     public TimeSince getLastLink() {
84         return lastLink;
85     }
86
87     public void setLastLink(TimeSince lastLink) {
88         this.lastLink = lastLink;
89     }
90
91     public BedSideStatus withLastLink(TimeSince lastLink) {
92         setLastLink(lastLink);
93         return this;
94     }
95
96     public Integer getPressure() {
97         return pressure;
98     }
99
100     public void setPressure(Integer pressure) {
101         this.pressure = pressure;
102     }
103
104     public BedSideStatus withPressure(Integer pressure) {
105         setPressure(pressure);
106         return this;
107     }
108
109     @Override
110     public int hashCode() {
111         final int prime = 31;
112         int result = 1;
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());
119         return result;
120     }
121
122     @Override
123     public boolean equals(Object obj) {
124         if (this == obj) {
125             return true;
126         }
127         if (obj == null) {
128             return false;
129         }
130         if (!(obj instanceof BedSideStatus)) {
131             return false;
132         }
133         BedSideStatus other = (BedSideStatus) obj;
134         if (alertDetailedMessage == null) {
135             if (other.alertDetailedMessage != null) {
136                 return false;
137             }
138         } else if (!alertDetailedMessage.equals(other.alertDetailedMessage)) {
139             return false;
140         }
141         if (alertId == null) {
142             if (other.alertId != null) {
143                 return false;
144             }
145         } else if (!alertId.equals(other.alertId)) {
146             return false;
147         }
148         if (inBed == null) {
149             if (other.inBed != null) {
150                 return false;
151             }
152         } else if (!inBed.equals(other.inBed)) {
153             return false;
154         }
155         if (lastLink == null) {
156             if (other.lastLink != null) {
157                 return false;
158             }
159         } else if (!lastLink.equals(other.lastLink)) {
160             return false;
161         }
162         if (pressure == null) {
163             if (other.pressure != null) {
164                 return false;
165             }
166         } else if (!pressure.equals(other.pressure)) {
167             return false;
168         }
169         if (sleepNumber == null) {
170             if (other.sleepNumber != null) {
171                 return false;
172             }
173         } else if (!sleepNumber.equals(other.sleepNumber)) {
174             return false;
175         }
176         return true;
177     }
178
179     @Override
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);
194         builder.append("]");
195         return builder.toString();
196     }
197 }