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_ALARM;
17 import java.util.ArrayList;
18 import java.util.List;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.core.thing.ThingTypeUID;
25 * The alarms of the Verisure System.
27 * @author Jan Gustafsson - Initial contribution
31 public class VerisureAlarmsDTO extends VerisureBaseThingDTO {
34 public ThingTypeUID getThingTypeUID() {
35 return THING_TYPE_ALARM;
39 public int hashCode() {
40 return super.hashCode();
43 @SuppressWarnings("PMD.SimplifyBooleanReturns")
45 public boolean equals(@Nullable Object obj) {
49 if (!super.equals(obj)) {
55 if (getClass() != obj.getClass()) {
61 public static class ArmState {
63 private @Nullable String type;
64 private @Nullable String statusType;
65 private @Nullable String date;
66 private @Nullable String name;
67 private @Nullable String changedVia;
68 private boolean allowedForFirstLine;
69 private boolean allowed;
70 private List<Object> errorCodes = new ArrayList<>();
71 private @Nullable String typename;
73 public @Nullable String getType() {
77 public @Nullable String getStatusType() {
81 public void setStatusType(@Nullable String statusType) {
82 this.statusType = statusType;
85 public @Nullable String getDate() {
89 public @Nullable String getName() {
93 public @Nullable String getChangedVia() {
97 public boolean getAllowedForFirstLine() {
98 return allowedForFirstLine;
101 public boolean getAllowed() {
105 public List<Object> getErrorCodes() {
109 public @Nullable String getTypename() {
114 public int hashCode() {
115 final int prime = 31;
117 result = prime * result + (allowed ? 1231 : 1237);
118 result = prime * result + (allowedForFirstLine ? 1231 : 1237);
119 String localChangedVia = changedVia;
120 result = prime * result + ((localChangedVia == null) ? 0 : localChangedVia.hashCode());
121 String localDate = date;
122 result = prime * result + ((localDate == null) ? 0 : localDate.hashCode());
123 result = prime * result + errorCodes.hashCode();
124 String localName = name;
125 result = prime * result + ((localName == null) ? 0 : localName.hashCode());
126 String localStatusType = statusType;
127 result = prime * result + ((localStatusType == null) ? 0 : localStatusType.hashCode());
128 String localType = type;
129 result = prime * result + ((localType == null) ? 0 : localType.hashCode());
130 String localTypeName = typename;
131 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
136 public boolean equals(@Nullable Object obj) {
143 if (getClass() != obj.getClass()) {
146 ArmState other = (ArmState) obj;
147 if (allowed != other.allowed) {
150 if (allowedForFirstLine != other.allowedForFirstLine) {
153 String localChangedVia = changedVia;
154 if (localChangedVia == null) {
155 if (other.changedVia != null) {
158 } else if (!localChangedVia.equals(other.changedVia)) {
161 String localdate = date;
162 if (localdate == null) {
163 if (other.date != null) {
166 } else if (!localdate.equals(other.date)) {
169 if (!errorCodes.equals(other.errorCodes)) {
172 String localName = name;
173 if (localName == null) {
174 if (other.name != null) {
177 } else if (!localName.equals(other.name)) {
180 String localStatusType = statusType;
181 if (localStatusType == null) {
182 if (other.statusType != null) {
185 } else if (!localStatusType.equals(other.statusType)) {
188 String localType = type;
189 if (localType == null) {
190 if (other.type != null) {
193 } else if (!localType.equals(other.type)) {
196 String localTypeName = typename;
197 if (localTypeName == null) {
198 if (other.typename != null) {
201 } else if (!localTypeName.equals(other.typename)) {
208 public String toString() {
209 return "ArmState [type=" + type + ", statusType=" + statusType + ", date=" + date + ", name=" + name
210 + ", changedVia=" + changedVia + ", allowedForFirstLine=" + allowedForFirstLine + ", allowed="
211 + allowed + ", errorCodes=" + errorCodes + ", typename=" + typename + "]";