2 * Copyright (c) 2010-2022 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();
48 public boolean equals(@Nullable Object obj) {
55 if (getClass() != obj.getClass()) {
58 VerisureInstallationsDTO other = (VerisureInstallationsDTO) obj;
59 if (!data.equals(other.data)) {
66 public String toString() {
67 return "VerisureInstallationsDTO [data=" + data + "]";
70 public static class Data {
71 private Installation installation = new Installation();
72 private Account account = new Account();
74 public Account getAccount() {
78 public Installation getInstallation() {
82 public void setInstallation(Installation installation) {
83 this.installation = installation;
87 public int hashCode() {
90 result = prime * result + account.hashCode();
91 result = prime * result + installation.hashCode();
96 public boolean equals(@Nullable Object obj) {
103 if (getClass() != obj.getClass()) {
106 Data other = (Data) obj;
107 if (!account.equals(other.account)) {
110 if (!installation.equals(other.installation)) {
117 public String toString() {
118 return "Data [installation=" + installation + ", account=" + account + "]";
122 public static class Account {
124 @SerializedName("__typename")
125 private @Nullable String typename;
126 private List<Owainstallation> owainstallations = new ArrayList<>();
128 public @Nullable String getTypename() {
132 public List<Owainstallation> getOwainstallations() {
133 return owainstallations;
137 public int hashCode() {
138 final int prime = 31;
140 result = prime * result + owainstallations.hashCode();
141 String localTypeName = typename;
142 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
147 public boolean equals(@Nullable Object obj) {
154 if (getClass() != obj.getClass()) {
157 Account other = (Account) obj;
158 if (!owainstallations.equals(other.owainstallations)) {
161 String localTypeName = typename;
162 if (localTypeName == null) {
163 if (other.typename != null) {
166 } else if (!localTypeName.equals(other.typename)) {
173 public String toString() {
174 return "Account [typename=" + typename + ", owainstallations=" + owainstallations + "]";
178 public static class Owainstallation {
180 @SerializedName("__typename")
181 private @Nullable String typename;
182 private @Nullable String alias;
183 private @Nullable String dealerId;
184 private @Nullable String giid;
185 private @Nullable String subsidiary;
186 private @Nullable String type;
188 public @Nullable String getTypename() {
192 public @Nullable String getAlias() {
196 public @Nullable String getDealerId() {
200 public @Nullable String getGiid() {
204 public @Nullable String getSubsidiary() {
208 public @Nullable String getType() {
213 public int hashCode() {
214 final int prime = 31;
216 String localAlias = alias;
217 result = prime * result + ((localAlias == null) ? 0 : localAlias.hashCode());
218 String localDealerId = dealerId;
219 result = prime * result + ((localDealerId == null) ? 0 : localDealerId.hashCode());
220 String localGiid = giid;
221 result = prime * result + ((localGiid == null) ? 0 : localGiid.hashCode());
222 String localSubsidiary = subsidiary;
223 result = prime * result + ((localSubsidiary == null) ? 0 : localSubsidiary.hashCode());
224 String localType = type;
225 result = prime * result + ((localType == null) ? 0 : localType.hashCode());
226 String localTypeName = typename;
227 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
232 public boolean equals(@Nullable Object obj) {
239 if (getClass() != obj.getClass()) {
242 Owainstallation other = (Owainstallation) obj;
243 String localAlias = alias;
244 if (localAlias == null) {
245 if (other.alias != null) {
248 } else if (!localAlias.equals(other.alias)) {
251 String localDealerId = dealerId;
252 if (localDealerId == null) {
253 if (other.dealerId != null) {
256 } else if (!localDealerId.equals(other.dealerId)) {
259 String localGiid = giid;
260 if (localGiid == null) {
261 if (other.giid != null) {
264 } else if (!localGiid.equals(other.giid)) {
267 String localSubsidiary = subsidiary;
268 if (localSubsidiary == null) {
269 if (other.subsidiary != null) {
272 } else if (!localSubsidiary.equals(other.subsidiary)) {
275 String localType = type;
276 if (localType == null) {
277 if (other.type != null) {
280 } else if (!localType.equals(other.type)) {
283 String localTypeName = typename;
284 if (localTypeName == null) {
285 if (other.typename != null) {
288 } else if (!localTypeName.equals(other.typename)) {
295 public String toString() {
296 return "Owainstallation [typename=" + typename + ", alias=" + alias + ", dealerId=" + dealerId + ", giid="
297 + giid + ", subsidiary=" + subsidiary + ", type=" + type + "]";