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 static org.openhab.binding.verisure.internal.VerisureBindingConstants.THING_TYPE_SMARTPLUG;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.thing.ThingTypeUID;
21 import com.google.gson.annotations.SerializedName;
24 * The smart plugs of the Verisure System.
26 * @author Jan Gustafsson - Initial contribution
30 public class VerisureSmartPlugsDTO extends VerisureBaseThingDTO {
33 public ThingTypeUID getThingTypeUID() {
34 return THING_TYPE_SMARTPLUG;
38 public int hashCode() {
39 return super.hashCode();
43 public boolean equals(@Nullable Object obj) {
47 if (!super.equals(obj)) {
53 if (getClass() != obj.getClass()) {
59 public static class Smartplug {
61 private Device device = new Device();
62 private @Nullable String currentState;
63 private @Nullable String icon;
64 private boolean isHazardous;
65 @SerializedName("__typename")
66 private @Nullable String typename;
68 public Device getDevice() {
72 public @Nullable String getCurrentState() {
76 public @Nullable String getIcon() {
80 public boolean isHazardous() {
84 public @Nullable String getTypename() {
89 public int hashCode() {
92 String localCurrentState = currentState;
93 result = prime * result + ((localCurrentState == null) ? 0 : localCurrentState.hashCode());
94 result = prime * result + device.hashCode();
95 String localIcon = icon;
96 result = prime * result + ((localIcon == null) ? 0 : localIcon.hashCode());
97 result = prime * result + (isHazardous ? 1231 : 1237);
98 String localTypeName = typename;
99 result = prime * result + ((localTypeName == null) ? 0 : localTypeName.hashCode());
104 public boolean equals(@Nullable Object obj) {
111 if (getClass() != obj.getClass()) {
114 Smartplug other = (Smartplug) obj;
115 String localCurrentState = currentState;
116 if (localCurrentState == null) {
117 if (other.currentState != null) {
120 } else if (!localCurrentState.equals(other.currentState)) {
123 if (!device.equals(other.device)) {
126 String localIcon = icon;
127 if (localIcon == null) {
128 if (other.icon != null) {
131 } else if (!localIcon.equals(other.icon)) {
134 if (isHazardous != other.isHazardous) {
137 String localTypeName = typename;
138 if (localTypeName == null) {
139 if (other.typename != null) {
142 } else if (!localTypeName.equals(other.typename)) {
149 public String toString() {
150 return "Smartplug [device=" + device + ", currentState=" + currentState + ", icon=" + icon
151 + ", isHazardous=" + isHazardous + ", typename=" + typename + "]";