]> git.basschouten.com Git - openhab-addons.git/blob
507e53b46f5c1b8a71adc42f5f5075cb38540af7
[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.revogi.internal.api;
14
15 import java.util.List;
16 import java.util.Objects;
17
18 import com.google.gson.annotations.SerializedName;
19
20 /**
21  * {@link StatusDTO} is the internal data model used to control Revogi's SmartStrip
22  *
23  * @author Andi Bräu - Initial contribution
24  *
25  */
26 public class StatusDTO {
27     private final boolean online;
28     private final int responseCode;
29     @SerializedName("switch")
30     private final List<Integer> switchValue;
31     private final List<Integer> watt;
32     private final List<Integer> amp;
33
34     public StatusDTO() {
35         online = false;
36         responseCode = 0;
37         switchValue = null;
38         watt = null;
39         amp = null;
40     }
41
42     public StatusDTO(boolean online, int responseCode, List<Integer> switchValue, List<Integer> watt,
43             List<Integer> amp) {
44         this.online = online;
45         this.responseCode = responseCode;
46         this.switchValue = switchValue;
47         this.watt = watt;
48         this.amp = amp;
49     }
50
51     public boolean isOnline() {
52         return online;
53     }
54
55     public int getResponseCode() {
56         return responseCode;
57     }
58
59     public List<Integer> getSwitchValue() {
60         return switchValue;
61     }
62
63     public List<Integer> getWatt() {
64         return watt;
65     }
66
67     public List<Integer> getAmp() {
68         return amp;
69     }
70
71     @Override
72     public boolean equals(final Object o) {
73         if (this == o) {
74             return true;
75         }
76         if (o == null || getClass() != o.getClass()) {
77             return false;
78         }
79         StatusDTO status = (StatusDTO) o;
80         return online == status.online && responseCode == status.responseCode
81                 && Objects.equals(switchValue, status.switchValue) && Objects.equals(watt, status.watt)
82                 && Objects.equals(amp, status.amp);
83     }
84
85     @Override
86     public int hashCode() {
87         return Objects.hash(online, responseCode, switchValue, watt, amp);
88     }
89 }