]> git.basschouten.com Git - openhab-addons.git/blob
c5f25ab119bcf0bda86326c76f825d4964e06993
[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 /**
16  * The {@link BedStatus} holds the BedStatus response from the sleepiq API.
17  *
18  * @author Gregory Moyer - Initial contribution
19  */
20 public class BedStatus {
21     private Long status;
22     private String bedId;
23     private BedSideStatus leftSide;
24     private BedSideStatus rightSide;
25
26     public Long getStatus() {
27         return status;
28     }
29
30     public void setStatus(Long status) {
31         this.status = status;
32     }
33
34     public BedStatus withStatus(Long status) {
35         setStatus(status);
36         return this;
37     }
38
39     public String getBedId() {
40         return bedId;
41     }
42
43     public void setBedId(String bedId) {
44         this.bedId = bedId;
45     }
46
47     public BedStatus withBedId(String bedId) {
48         setBedId(bedId);
49         return this;
50     }
51
52     public BedSideStatus getLeftSide() {
53         return leftSide;
54     }
55
56     public void setLeftSide(BedSideStatus leftSide) {
57         this.leftSide = leftSide;
58     }
59
60     public BedStatus withLeftSide(BedSideStatus leftSide) {
61         setLeftSide(leftSide);
62         return this;
63     }
64
65     public BedSideStatus getRightSide() {
66         return rightSide;
67     }
68
69     public void setRightSide(BedSideStatus rightSide) {
70         this.rightSide = rightSide;
71     }
72
73     public BedStatus withRightSide(BedSideStatus rightSide) {
74         setRightSide(rightSide);
75         return this;
76     }
77
78     @Override
79     public int hashCode() {
80         final int prime = 31;
81         int result = 1;
82         result = prime * result + ((bedId == null) ? 0 : bedId.hashCode());
83         return result;
84     }
85
86     @Override
87     public boolean equals(Object obj) {
88         if (this == obj) {
89             return true;
90         }
91         if (obj == null) {
92             return false;
93         }
94         if (!(obj instanceof BedStatus)) {
95             return false;
96         }
97         BedStatus other = (BedStatus) obj;
98         if (bedId == null) {
99             if (other.bedId != null) {
100                 return false;
101             }
102         } else if (!bedId.equals(other.bedId)) {
103             return false;
104         }
105         return true;
106     }
107
108     @Override
109     public String toString() {
110         StringBuilder builder = new StringBuilder();
111         builder.append("BedStatus [status=");
112         builder.append(status);
113         builder.append(", bedId=");
114         builder.append(bedId);
115         builder.append(", leftSide=");
116         builder.append(leftSide);
117         builder.append(", rightSide=");
118         builder.append(rightSide);
119         builder.append("]");
120         return builder.toString();
121     }
122 }