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 java.util.ArrayList;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * The SmartLock state of the Verisure System.
24 * @author Jan Gustafsson - Initial contribution
28 public class VerisureSmartLockDTO {
30 private boolean autoRelockEnabled;
31 private @Nullable String deviceLabel;
32 private DoorLockVolumeSettings doorLockVolumeSettings = new DoorLockVolumeSettings();
34 public boolean getAutoRelockEnabled() {
35 return autoRelockEnabled;
38 public @Nullable String getDeviceLabel() {
42 public DoorLockVolumeSettings getDoorLockVolumeSettings() {
43 return doorLockVolumeSettings;
46 public static class DoorLockVolumeSettings {
47 private @Nullable String volume;
48 private @Nullable String voiceLevel;
49 private @Nullable String active;
50 private List<String> availableVolumes = new ArrayList<>();
51 private List<String> availableVoiceLevels = new ArrayList<>();
53 public @Nullable String getVolume() {
57 public @Nullable String getVoiceLevel() {
61 public @Nullable String getActive() {
65 public List<String> getAvailableVolumes() {
66 return availableVolumes;
69 public List<String> getAvailableVoiceLevels() {
70 return availableVoiceLevels;
74 public int hashCode() {
77 String localActive = active;
78 result = prime * result + ((localActive == null) ? 0 : localActive.hashCode());
79 result = prime * result + availableVoiceLevels.hashCode();
80 result = prime * result + availableVolumes.hashCode();
81 String localVoiceLevel = voiceLevel;
82 result = prime * result + ((localVoiceLevel == null) ? 0 : localVoiceLevel.hashCode());
83 String localVolume = volume;
84 result = prime * result + ((localVolume == null) ? 0 : localVolume.hashCode());
89 public boolean equals(@Nullable Object obj) {
96 if (getClass() != obj.getClass()) {
99 DoorLockVolumeSettings other = (DoorLockVolumeSettings) obj;
100 String localActive = active;
101 if (localActive == null) {
102 if (other.active != null) {
105 } else if (!localActive.equals(other.active)) {
108 if (!availableVoiceLevels.equals(other.availableVoiceLevels)) {
111 if (!availableVolumes.equals(other.availableVolumes)) {
114 String localVoiceLevel = voiceLevel;
115 if (localVoiceLevel == null) {
116 if (other.voiceLevel != null) {
119 } else if (!localVoiceLevel.equals(other.voiceLevel)) {
122 String localVolume = volume;
123 if (localVolume == null) {
124 if (other.volume != null) {
127 } else if (!localVolume.equals(other.volume)) {
134 public String toString() {
135 return "DoorLockVolumeSettings [volume=" + volume + ", voiceLevel=" + voiceLevel + ", active=" + active
136 + ", availableVolumes=" + availableVolumes + ", availableVoiceLevels=" + availableVoiceLevels + "]";
141 public int hashCode() {
142 final int prime = 31;
144 result = prime * result + (autoRelockEnabled ? 1231 : 1237);
145 String localDeviceLabel = deviceLabel;
146 result = prime * result + ((localDeviceLabel == null) ? 0 : localDeviceLabel.hashCode());
147 result = prime * result + doorLockVolumeSettings.hashCode();
151 @SuppressWarnings("PMD.SimplifyBooleanReturns")
153 public boolean equals(@Nullable Object obj) {
160 if (getClass() != obj.getClass()) {
163 VerisureSmartLockDTO other = (VerisureSmartLockDTO) obj;
164 if (autoRelockEnabled != other.autoRelockEnabled) {
167 String localDeviceLabel = deviceLabel;
168 if (localDeviceLabel == null) {
169 if (other.deviceLabel != null) {
172 } else if (!localDeviceLabel.equals(other.deviceLabel)) {
175 if (!doorLockVolumeSettings.equals(other.doorLockVolumeSettings)) {
182 public String toString() {
183 return "VerisureSmartLockDTO [autoRelockEnabled=" + autoRelockEnabled + ", deviceLabel=" + deviceLabel
184 + ", doorLockVolumeSettings=" + doorLockVolumeSettings + "]";