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_SMARTLOCK;
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 smart locks of the Verisure System.
26 * @author Jan Gustafsson - Initial contribution
30 public class VerisureSmartLocksDTO extends VerisureBaseThingDTO {
32 private @Nullable VerisureSmartLockDTO smartLockJSON;
34 public @Nullable VerisureSmartLockDTO getSmartLockJSON() {
38 public void setSmartLockJSON(@Nullable VerisureSmartLockDTO smartLockJSON) {
39 this.smartLockJSON = smartLockJSON;
43 public ThingTypeUID getThingTypeUID() {
44 return THING_TYPE_SMARTLOCK;
48 public int hashCode() {
50 int result = super.hashCode();
51 VerisureSmartLockDTO localSmartLockJSON = smartLockJSON;
52 result = prime * result + ((localSmartLockJSON == null) ? 0 : localSmartLockJSON.hashCode());
57 public boolean equals(@Nullable Object obj) {
61 if (!super.equals(obj)) {
67 if (getClass() != obj.getClass()) {
70 VerisureSmartLocksDTO other = (VerisureSmartLocksDTO) obj;
71 VerisureSmartLockDTO localSmartLockJSON = smartLockJSON;
72 if (localSmartLockJSON == null) {
73 if (other.smartLockJSON != null) {
76 } else if (!localSmartLockJSON.equals(other.smartLockJSON)) {
83 public String toString() {
84 return "VerisureSmartLocksDTO [smartLockJSON=" + smartLockJSON + "]";
87 public static class Doorlock {
89 @SerializedName("__typename")
90 private @Nullable String typename;
91 private @Nullable String currentLockState;
92 private @Nullable String eventTime;
93 private @Nullable String method;
94 private @Nullable String userString;
95 private Device device = new Device();
96 private boolean motorJam;
97 private boolean secureModeActive;
99 public @Nullable String getTypename() {
103 public @Nullable String getCurrentLockState() {
104 return currentLockState;
107 public Device getDevice() {
111 public @Nullable String getEventTime() {
115 public @Nullable String getMethod() {
119 public boolean isMotorJam() {
123 public boolean getSecureModeActive() {
124 return secureModeActive;
127 public @Nullable String getUserString() {
132 public int hashCode() {
133 final int prime = 31;
135 String localCurrentLockState = currentLockState;
136 result = prime * result + ((localCurrentLockState == null) ? 0 : localCurrentLockState.hashCode());
137 result = prime * result + device.hashCode();
138 String localEventTime = eventTime;
139 result = prime * result + ((localEventTime == null) ? 0 : localEventTime.hashCode());
140 String localMethod = method;
141 result = prime * result + ((localMethod == null) ? 0 : localMethod.hashCode());
142 result = prime * result + (motorJam ? 1231 : 1237);
143 result = prime * result + (secureModeActive ? 1231 : 1237);
144 String localTypeName = typename;
145 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
146 String localUserString = userString;
147 result = prime * result + ((localUserString == null) ? 0 : localUserString.hashCode());
152 public boolean equals(@Nullable Object obj) {
159 if (getClass() != obj.getClass()) {
162 Doorlock other = (Doorlock) obj;
163 String localCurrentLockState = currentLockState;
164 if (localCurrentLockState == null) {
165 if (other.currentLockState != null) {
168 } else if (!localCurrentLockState.equals(other.currentLockState)) {
171 if (!device.equals(other.device)) {
174 String localEventTime = eventTime;
175 if (localEventTime == null) {
176 if (other.eventTime != null) {
179 } else if (!localEventTime.equals(other.eventTime)) {
182 String localMethod = method;
183 if (localMethod == null) {
184 if (other.method != null) {
187 } else if (!localMethod.equals(other.method)) {
190 if (motorJam != other.motorJam) {
193 if (secureModeActive != other.secureModeActive) {
196 String localTypeName = typename;
197 if (localTypeName == null) {
198 if (other.typename != null) {
201 } else if (!localTypeName.equals(other.typename)) {
204 String localUserString = userString;
205 if (localUserString == null) {
206 if (other.userString != null) {
209 } else if (!localUserString.equals(other.userString)) {
216 public String toString() {
217 return "Doorlock [typename=" + typename + ", currentLockState=" + currentLockState + ", eventTime="
218 + eventTime + ", method=" + method + ", userString=" + userString + ", device=" + device
219 + ", motorJam=" + motorJam + ", secureModeActive=" + secureModeActive + "]";