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;
20 import org.openhab.binding.verisure.internal.dto.VerisureBaseThingDTO.Installation;
22 import com.google.gson.annotations.SerializedName;
25 * The installation(s) of the Verisure System.
27 * @author Jan Gustafsson - Initial contribution
31 public class VerisureInstallationsDTO {
33 private Data data = new Data();
35 public Data getData() {
40 public int hashCode() {
43 result = prime * result + data.hashCode();
47 @SuppressWarnings("PMD.SimplifyBooleanReturns")
49 public boolean equals(@Nullable Object obj) {
56 if (getClass() != obj.getClass()) {
59 VerisureInstallationsDTO other = (VerisureInstallationsDTO) obj;
60 if (!data.equals(other.data)) {
67 public String toString() {
68 return "VerisureInstallationsDTO [data=" + data + "]";
71 public static class Data {
72 private Installation installation = new Installation();
73 private Account account = new Account();
75 public Account getAccount() {
79 public Installation getInstallation() {
83 public void setInstallation(Installation installation) {
84 this.installation = installation;
88 public int hashCode() {
91 result = prime * result + account.hashCode();
92 result = prime * result + installation.hashCode();
96 @SuppressWarnings("PMD.SimplifyBooleanReturns")
98 public boolean equals(@Nullable Object obj) {
105 if (getClass() != obj.getClass()) {
108 Data other = (Data) obj;
109 if (!account.equals(other.account)) {
112 if (!installation.equals(other.installation)) {
119 public String toString() {
120 return "Data [installation=" + installation + ", account=" + account + "]";
124 public static class Account {
126 @SerializedName("__typename")
127 private @Nullable String typename;
128 private List<Owainstallation> owainstallations = new ArrayList<>();
130 public @Nullable String getTypename() {
134 public List<Owainstallation> getOwainstallations() {
135 return owainstallations;
139 public int hashCode() {
140 final int prime = 31;
142 result = prime * result + owainstallations.hashCode();
143 String localTypeName = typename;
144 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
149 public boolean equals(@Nullable Object obj) {
156 if (getClass() != obj.getClass()) {
159 Account other = (Account) obj;
160 if (!owainstallations.equals(other.owainstallations)) {
163 String localTypeName = typename;
164 if (localTypeName == null) {
165 if (other.typename != null) {
168 } else if (!localTypeName.equals(other.typename)) {
175 public String toString() {
176 return "Account [typename=" + typename + ", owainstallations=" + owainstallations + "]";
180 public static class Owainstallation {
182 @SerializedName("__typename")
183 private @Nullable String typename;
184 private @Nullable String alias;
185 private @Nullable String dealerId;
186 private @Nullable String giid;
187 private @Nullable String subsidiary;
188 private @Nullable String type;
190 public @Nullable String getTypename() {
194 public @Nullable String getAlias() {
198 public @Nullable String getDealerId() {
202 public @Nullable String getGiid() {
206 public @Nullable String getSubsidiary() {
210 public @Nullable String getType() {
215 public int hashCode() {
216 final int prime = 31;
218 String localAlias = alias;
219 result = prime * result + ((localAlias == null) ? 0 : localAlias.hashCode());
220 String localDealerId = dealerId;
221 result = prime * result + ((localDealerId == null) ? 0 : localDealerId.hashCode());
222 String localGiid = giid;
223 result = prime * result + ((localGiid == null) ? 0 : localGiid.hashCode());
224 String localSubsidiary = subsidiary;
225 result = prime * result + ((localSubsidiary == null) ? 0 : localSubsidiary.hashCode());
226 String localType = type;
227 result = prime * result + ((localType == null) ? 0 : localType.hashCode());
228 String localTypeName = typename;
229 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
234 public boolean equals(@Nullable Object obj) {
241 if (getClass() != obj.getClass()) {
244 Owainstallation other = (Owainstallation) obj;
245 String localAlias = alias;
246 if (localAlias == null) {
247 if (other.alias != null) {
250 } else if (!localAlias.equals(other.alias)) {
253 String localDealerId = dealerId;
254 if (localDealerId == null) {
255 if (other.dealerId != null) {
258 } else if (!localDealerId.equals(other.dealerId)) {
261 String localGiid = giid;
262 if (localGiid == null) {
263 if (other.giid != null) {
266 } else if (!localGiid.equals(other.giid)) {
269 String localSubsidiary = subsidiary;
270 if (localSubsidiary == null) {
271 if (other.subsidiary != null) {
274 } else if (!localSubsidiary.equals(other.subsidiary)) {
277 String localType = type;
278 if (localType == null) {
279 if (other.type != null) {
282 } else if (!localType.equals(other.type)) {
285 String localTypeName = typename;
286 if (localTypeName == null) {
287 if (other.typename != null) {
290 } else if (!localTypeName.equals(other.typename)) {
297 public String toString() {
298 return "Owainstallation [typename=" + typename + ", alias=" + alias + ", dealerId=" + dealerId + ", giid="
299 + giid + ", subsidiary=" + subsidiary + ", type=" + type + "]";