]> git.basschouten.com Git - openhab-addons.git/blob
d4473f8b0bca871d921fff518487d1563f16babf
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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     @Override
48     public boolean equals(@Nullable Object obj) {
49         if (this == obj) {
50             return true;
51         }
52         if (obj == null) {
53             return false;
54         }
55         if (getClass() != obj.getClass()) {
56             return false;
57         }
58         VerisureInstallationsDTO other = (VerisureInstallationsDTO) obj;
59         if (!data.equals(other.data)) {
60             return false;
61         }
62         return true;
63     }
64
65     @Override
66     public String toString() {
67         return "VerisureInstallationsDTO [data=" + data + "]";
68     }
69
70     public static class Data {
71         private Installation installation = new Installation();
72         private Account account = new Account();
73
74         public Account getAccount() {
75             return account;
76         }
77
78         public Installation getInstallation() {
79             return installation;
80         }
81
82         public void setInstallation(Installation installation) {
83             this.installation = installation;
84         }
85
86         @Override
87         public int hashCode() {
88             final int prime = 31;
89             int result = 1;
90             result = prime * result + account.hashCode();
91             result = prime * result + installation.hashCode();
92             return result;
93         }
94
95         @Override
96         public boolean equals(@Nullable Object obj) {
97             if (this == obj) {
98                 return true;
99             }
100             if (obj == null) {
101                 return false;
102             }
103             if (getClass() != obj.getClass()) {
104                 return false;
105             }
106             Data other = (Data) obj;
107             if (!account.equals(other.account)) {
108                 return false;
109             }
110             if (!installation.equals(other.installation)) {
111                 return false;
112             }
113             return true;
114         }
115
116         @Override
117         public String toString() {
118             return "Data [installation=" + installation + ", account=" + account + "]";
119         }
120     }
121
122     public static class Account {
123
124         @SerializedName("__typename")
125         private @Nullable String typename;
126         private List<Owainstallation> owainstallations = new ArrayList<>();
127
128         public @Nullable String getTypename() {
129             return typename;
130         }
131
132         public List<Owainstallation> getOwainstallations() {
133             return owainstallations;
134         }
135
136         @Override
137         public int hashCode() {
138             final int prime = 31;
139             int result = 1;
140             result = prime * result + owainstallations.hashCode();
141             String localTypeName = typename;
142             result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
143             return result;
144         }
145
146         @Override
147         public boolean equals(@Nullable Object obj) {
148             if (this == obj) {
149                 return true;
150             }
151             if (obj == null) {
152                 return false;
153             }
154             if (getClass() != obj.getClass()) {
155                 return false;
156             }
157             Account other = (Account) obj;
158             if (!owainstallations.equals(other.owainstallations)) {
159                 return false;
160             }
161             String localTypeName = typename;
162             if (localTypeName == null) {
163                 if (other.typename != null) {
164                     return false;
165                 }
166             } else if (!localTypeName.equals(other.typename)) {
167                 return false;
168             }
169             return true;
170         }
171
172         @Override
173         public String toString() {
174             return "Account [typename=" + typename + ", owainstallations=" + owainstallations + "]";
175         }
176     }
177
178     public static class Owainstallation {
179
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;
187
188         public @Nullable String getTypename() {
189             return typename;
190         }
191
192         public @Nullable String getAlias() {
193             return alias;
194         }
195
196         public @Nullable String getDealerId() {
197             return dealerId;
198         }
199
200         public @Nullable String getGiid() {
201             return giid;
202         }
203
204         public @Nullable String getSubsidiary() {
205             return subsidiary;
206         }
207
208         public @Nullable String getType() {
209             return type;
210         }
211
212         @Override
213         public int hashCode() {
214             final int prime = 31;
215             int result = 1;
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());
228             return result;
229         }
230
231         @Override
232         public boolean equals(@Nullable Object obj) {
233             if (this == obj) {
234                 return true;
235             }
236             if (obj == null) {
237                 return false;
238             }
239             if (getClass() != obj.getClass()) {
240                 return false;
241             }
242             Owainstallation other = (Owainstallation) obj;
243             String localAlias = alias;
244             if (localAlias == null) {
245                 if (other.alias != null) {
246                     return false;
247                 }
248             } else if (!localAlias.equals(other.alias)) {
249                 return false;
250             }
251             String localDealerId = dealerId;
252             if (localDealerId == null) {
253                 if (other.dealerId != null) {
254                     return false;
255                 }
256             } else if (!localDealerId.equals(other.dealerId)) {
257                 return false;
258             }
259             String localGiid = giid;
260             if (localGiid == null) {
261                 if (other.giid != null) {
262                     return false;
263                 }
264             } else if (!localGiid.equals(other.giid)) {
265                 return false;
266             }
267             String localSubsidiary = subsidiary;
268             if (localSubsidiary == null) {
269                 if (other.subsidiary != null) {
270                     return false;
271                 }
272             } else if (!localSubsidiary.equals(other.subsidiary)) {
273                 return false;
274             }
275             String localType = type;
276             if (localType == null) {
277                 if (other.type != null) {
278                     return false;
279                 }
280             } else if (!localType.equals(other.type)) {
281                 return false;
282             }
283             String localTypeName = typename;
284             if (localTypeName == null) {
285                 if (other.typename != null) {
286                     return false;
287                 }
288             } else if (!localTypeName.equals(other.typename)) {
289                 return false;
290             }
291             return true;
292         }
293
294         @Override
295         public String toString() {
296             return "Owainstallation [typename=" + typename + ", alias=" + alias + ", dealerId=" + dealerId + ", giid="
297                     + giid + ", subsidiary=" + subsidiary + ", type=" + type + "]";
298         }
299     }
300 }