]> git.basschouten.com Git - openhab-addons.git/blob
e462a6a9fb3e14bcab4d6fdb156e449de5472d6f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.verisure.internal.dto;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.verisure.internal.dto.VerisureBaseThingDTO.Installation;
21
22 import com.google.gson.annotations.SerializedName;
23
24 /**
25  * The installation(s) of the Verisure System.
26  *
27  * @author Jan Gustafsson - Initial contribution
28  *
29  */
30 @NonNullByDefault
31 public class VerisureInstallationsDTO {
32
33     private Data data = new Data();
34
35     public Data getData() {
36         return data;
37     }
38
39     @Override
40     public int hashCode() {
41         final int prime = 31;
42         int result = 1;
43         result = prime * result + data.hashCode();
44         return result;
45     }
46
47     @SuppressWarnings("PMD.SimplifyBooleanReturns")
48     @Override
49     public boolean equals(@Nullable Object obj) {
50         if (this == obj) {
51             return true;
52         }
53         if (obj == null) {
54             return false;
55         }
56         if (getClass() != obj.getClass()) {
57             return false;
58         }
59         VerisureInstallationsDTO other = (VerisureInstallationsDTO) obj;
60         if (!data.equals(other.data)) {
61             return false;
62         }
63         return true;
64     }
65
66     @Override
67     public String toString() {
68         return "VerisureInstallationsDTO [data=" + data + "]";
69     }
70
71     public static class Data {
72         private Installation installation = new Installation();
73         private Account account = new Account();
74
75         public Account getAccount() {
76             return account;
77         }
78
79         public Installation getInstallation() {
80             return installation;
81         }
82
83         public void setInstallation(Installation installation) {
84             this.installation = installation;
85         }
86
87         @Override
88         public int hashCode() {
89             final int prime = 31;
90             int result = 1;
91             result = prime * result + account.hashCode();
92             result = prime * result + installation.hashCode();
93             return result;
94         }
95
96         @SuppressWarnings("PMD.SimplifyBooleanReturns")
97         @Override
98         public boolean equals(@Nullable Object obj) {
99             if (this == obj) {
100                 return true;
101             }
102             if (obj == null) {
103                 return false;
104             }
105             if (getClass() != obj.getClass()) {
106                 return false;
107             }
108             Data other = (Data) obj;
109             if (!account.equals(other.account)) {
110                 return false;
111             }
112             if (!installation.equals(other.installation)) {
113                 return false;
114             }
115             return true;
116         }
117
118         @Override
119         public String toString() {
120             return "Data [installation=" + installation + ", account=" + account + "]";
121         }
122     }
123
124     public static class Account {
125
126         @SerializedName("__typename")
127         private @Nullable String typename;
128         private List<Owainstallation> owainstallations = new ArrayList<>();
129
130         public @Nullable String getTypename() {
131             return typename;
132         }
133
134         public List<Owainstallation> getOwainstallations() {
135             return owainstallations;
136         }
137
138         @Override
139         public int hashCode() {
140             final int prime = 31;
141             int result = 1;
142             result = prime * result + owainstallations.hashCode();
143             String localTypeName = typename;
144             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
145             return result;
146         }
147
148         @Override
149         public boolean equals(@Nullable Object obj) {
150             if (this == obj) {
151                 return true;
152             }
153             if (obj == null) {
154                 return false;
155             }
156             if (getClass() != obj.getClass()) {
157                 return false;
158             }
159             Account other = (Account) obj;
160             if (!owainstallations.equals(other.owainstallations)) {
161                 return false;
162             }
163             String localTypeName = typename;
164             if (localTypeName == null) {
165                 if (other.typename != null) {
166                     return false;
167                 }
168             } else if (!localTypeName.equals(other.typename)) {
169                 return false;
170             }
171             return true;
172         }
173
174         @Override
175         public String toString() {
176             return "Account [typename=" + typename + ", owainstallations=" + owainstallations + "]";
177         }
178     }
179
180     public static class Owainstallation {
181
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;
189
190         public @Nullable String getTypename() {
191             return typename;
192         }
193
194         public @Nullable String getAlias() {
195             return alias;
196         }
197
198         public @Nullable String getDealerId() {
199             return dealerId;
200         }
201
202         public @Nullable String getGiid() {
203             return giid;
204         }
205
206         public @Nullable String getSubsidiary() {
207             return subsidiary;
208         }
209
210         public @Nullable String getType() {
211             return type;
212         }
213
214         @Override
215         public int hashCode() {
216             final int prime = 31;
217             int result = 1;
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());
230             return result;
231         }
232
233         @Override
234         public boolean equals(@Nullable Object obj) {
235             if (this == obj) {
236                 return true;
237             }
238             if (obj == null) {
239                 return false;
240             }
241             if (getClass() != obj.getClass()) {
242                 return false;
243             }
244             Owainstallation other = (Owainstallation) obj;
245             String localAlias = alias;
246             if (localAlias == null) {
247                 if (other.alias != null) {
248                     return false;
249                 }
250             } else if (!localAlias.equals(other.alias)) {
251                 return false;
252             }
253             String localDealerId = dealerId;
254             if (localDealerId == null) {
255                 if (other.dealerId != null) {
256                     return false;
257                 }
258             } else if (!localDealerId.equals(other.dealerId)) {
259                 return false;
260             }
261             String localGiid = giid;
262             if (localGiid == null) {
263                 if (other.giid != null) {
264                     return false;
265                 }
266             } else if (!localGiid.equals(other.giid)) {
267                 return false;
268             }
269             String localSubsidiary = subsidiary;
270             if (localSubsidiary == null) {
271                 if (other.subsidiary != null) {
272                     return false;
273                 }
274             } else if (!localSubsidiary.equals(other.subsidiary)) {
275                 return false;
276             }
277             String localType = type;
278             if (localType == null) {
279                 if (other.type != null) {
280                     return false;
281                 }
282             } else if (!localType.equals(other.type)) {
283                 return false;
284             }
285             String localTypeName = typename;
286             if (localTypeName == null) {
287                 if (other.typename != null) {
288                     return false;
289                 }
290             } else if (!localTypeName.equals(other.typename)) {
291                 return false;
292             }
293             return true;
294         }
295
296         @Override
297         public String toString() {
298             return "Owainstallation [typename=" + typename + ", alias=" + alias + ", dealerId=" + dealerId + ", giid="
299                     + giid + ", subsidiary=" + subsidiary + ", type=" + type + "]";
300         }
301     }
302 }