]> git.basschouten.com Git - openhab-addons.git/blob
9c3d5d0e266b1a70e611a29edb940c7fb490db90
[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.amazonechocontrol.internal.jsons;
14
15 import java.util.List;
16 import java.util.Objects;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeCapabilities.SmartHomeCapability;
21 import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeDeviceNetworkState.SmartHomeDeviceNetworkState;
22 import org.openhab.binding.amazonechocontrol.internal.jsons.JsonSmartHomeTags.JsonSmartHomeTag;
23
24 /**
25  * @author Lukas Knoeller - Initial contribution
26  */
27 @NonNullByDefault
28 public class JsonSmartHomeDevices {
29     public static class SmartHomeDevice implements SmartHomeBaseDevice {
30         public @Nullable Integer updateIntervalInSeconds;
31         public @Nullable String applianceId;
32         public @Nullable String manufacturerName;
33         public @Nullable String friendlyDescription;
34         public @Nullable String modelName;
35         public @Nullable String friendlyName;
36         public @Nullable String reachability;
37         public @Nullable String entityId;
38         public @Nullable SmartHomeDeviceNetworkState applianceNetworkState;
39         public @Nullable List<SmartHomeCapability> capabilities;
40         public @Nullable JsonSmartHomeTag tags;
41         public @Nullable List<String> applianceTypes;
42         public @Nullable List<JsonSmartHomeDeviceAlias> aliases;
43         public @Nullable List<SmartHomeDevice> groupDevices;
44         public @Nullable String connectedVia;
45         public @Nullable DriverIdentity driverIdentity;
46         public @Nullable List<String> mergedApplianceIds;
47         public @Nullable List<SmartHomeDevice> smarthomeDevices;
48
49         public List<SmartHomeCapability> getCapabilities() {
50             return Objects.requireNonNullElse(capabilities, List.of());
51         }
52
53         @Override
54         public @Nullable String findId() {
55             return applianceId;
56         }
57
58         @Override
59         public @Nullable String findEntityId() {
60             return entityId;
61         }
62
63         @Override
64         public boolean isGroup() {
65             return false;
66         }
67
68         @Override
69         public String toString() {
70             return "SmartHomeDevice{" + "updateIntervalInSeconds=" + updateIntervalInSeconds + ", applianceId='"
71                     + applianceId + '\'' + ", manufacturerName='" + manufacturerName + '\'' + ", friendlyDescription='"
72                     + friendlyDescription + '\'' + ", modelName='" + modelName + '\'' + ", friendlyName='"
73                     + friendlyName + '\'' + ", reachability='" + reachability + '\'' + ", entityId='" + entityId + '\''
74                     + ", applianceNetworkState=" + applianceNetworkState + ", capabilities=" + capabilities + ", tags="
75                     + tags + ", applianceTypes=" + applianceTypes + ", aliases=" + aliases + ", groupDevices="
76                     + groupDevices + ", connectedVia='" + connectedVia + '\'' + ", driverIdentity=" + driverIdentity
77                     + ", mergedApplianceIds=" + mergedApplianceIds + ", smarthomeDevices=" + smarthomeDevices + '}';
78         }
79     }
80
81     public static class DriverIdentity {
82         public @Nullable String namespace;
83         public @Nullable String identifier;
84
85         @Override
86         public String toString() {
87             return "DriverIdentity{" + "namespace='" + namespace + '\'' + ", identifier='" + identifier + '\'' + '}';
88         }
89     }
90 }