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.verisure.internal.dto;
15 import static org.openhab.binding.verisure.internal.VerisureBindingConstants.THING_TYPE_USERPRESENCE;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ThingTypeUID;
21 import com.google.gson.annotations.SerializedName;
24 * The user presences of the Verisure System.
26 * @author Jan Gustafsson - Initial contribution
30 public class VerisureUserPresencesDTO extends VerisureBaseThingDTO {
33 public ThingTypeUID getThingTypeUID() {
34 return THING_TYPE_USERPRESENCE;
38 public int hashCode() {
39 return super.hashCode();
43 public boolean equals(@Nullable Object obj) {
47 if (!super.equals(obj)) {
53 if (getClass() != obj.getClass()) {
59 public static class UserTracking {
60 private boolean isCallingUser;
61 private @Nullable String webAccount;
62 private @Nullable String status;
63 private @Nullable String xbnContactId;
64 private @Nullable String currentLocationName;
65 private String deviceId = "";
66 private @Nullable String name;
67 private @Nullable String currentLocationTimestamp;
68 private @Nullable String deviceName;
69 private @Nullable String currentLocationId;
70 @SerializedName("__typename")
71 private @Nullable String typename;
73 public boolean getIsCallingUser() {
77 public @Nullable String getWebAccount() {
81 public @Nullable String getStatus() {
85 public @Nullable String getXbnContactId() {
89 public @Nullable String getCurrentLocationName() {
90 return currentLocationName;
93 public @Nullable String getDeviceId() {
97 public @Nullable String getName() {
101 public @Nullable String getCurrentLocationTimestamp() {
102 return currentLocationTimestamp;
105 public @Nullable String getDeviceName() {
109 public @Nullable String getCurrentLocationId() {
110 return currentLocationId;
113 public @Nullable String getTypename() {
118 public int hashCode() {
119 final int prime = 31;
121 String localCurrentLocationId = currentLocationId;
122 result = prime * result + ((localCurrentLocationId == null) ? 0 : localCurrentLocationId.hashCode());
123 String localCurrentLocationName = currentLocationName;
124 result = prime * result + ((localCurrentLocationName == null) ? 0 : localCurrentLocationName.hashCode());
125 String localCurrentLocationTimestamp = currentLocationTimestamp;
126 result = prime * result
127 + ((localCurrentLocationTimestamp == null) ? 0 : localCurrentLocationTimestamp.hashCode());
128 result = prime * result + deviceId.hashCode();
129 String localDeviceName = deviceName;
130 result = prime * result + ((localDeviceName == null) ? 0 : localDeviceName.hashCode());
131 result = prime * result + (isCallingUser ? 1231 : 1237);
132 String localName = name;
133 result = prime * result + ((localName == null) ? 0 : localName.hashCode());
134 String localStatus = status;
135 result = prime * result + ((localStatus == null) ? 0 : localStatus.hashCode());
136 String localTypeName = typename;
137 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
138 String localWebAccount = webAccount;
139 result = prime * result + ((localWebAccount == null) ? 0 : localWebAccount.hashCode());
140 String localXbnContactId = xbnContactId;
141 result = prime * result + ((localXbnContactId == null) ? 0 : localXbnContactId.hashCode());
146 public boolean equals(@Nullable Object obj) {
153 if (getClass() != obj.getClass()) {
156 UserTracking other = (UserTracking) obj;
157 String localCurrentLocationId = currentLocationId;
158 if (localCurrentLocationId == null) {
159 if (other.currentLocationId != null) {
162 } else if (!localCurrentLocationId.equals(other.currentLocationId)) {
165 String localCurrentLocationName = currentLocationName;
166 if (localCurrentLocationName == null) {
167 if (other.currentLocationName != null) {
170 } else if (!localCurrentLocationName.equals(other.currentLocationName)) {
173 String localCurrentLocationTimestamp = currentLocationTimestamp;
174 if (localCurrentLocationTimestamp == null) {
175 if (other.currentLocationTimestamp != null) {
178 } else if (!localCurrentLocationTimestamp.equals(other.currentLocationTimestamp)) {
181 if (!deviceId.equals(other.deviceId)) {
184 String localDeviceName = deviceName;
185 if (localDeviceName == null) {
186 if (other.deviceName != null) {
189 } else if (!localDeviceName.equals(other.deviceName)) {
192 if (isCallingUser != other.isCallingUser) {
195 String localName = name;
196 if (localName == null) {
197 if (other.name != null) {
200 } else if (!localName.equals(other.name)) {
203 String localStatus = status;
204 if (localStatus == null) {
205 if (other.status != null) {
208 } else if (!localStatus.equals(other.status)) {
211 String localTypeName = typename;
212 if (localTypeName == null) {
213 if (other.typename != null) {
216 } else if (!localTypeName.equals(other.typename)) {
219 String localWebAccount = webAccount;
220 if (localWebAccount == null) {
221 if (other.webAccount != null) {
224 } else if (!localWebAccount.equals(other.webAccount)) {
227 String localXbnContactId = xbnContactId;
228 if (localXbnContactId == null) {
229 if (other.xbnContactId != null) {
232 } else if (!localXbnContactId.equals(other.xbnContactId)) {
239 public String toString() {
240 return "UserTracking [isCallingUser=" + isCallingUser + ", webAccount=" + webAccount + ", status=" + status
241 + ", xbnContactId=" + xbnContactId + ", currentLocationName=" + currentLocationName + ", deviceId="
242 + deviceId + ", name=" + name + ", currentLocationTimestamp=" + currentLocationTimestamp
243 + ", deviceName=" + deviceName + ", currentLocationId=" + currentLocationId + ", typename="