]> git.basschouten.com Git - openhab-addons.git/blob
25a28fd54c07a7d06032a01eb24973e0904ebf09
[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.neeo.internal.models;
14
15 import java.util.Arrays;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 /**
21  * The model representing a Neeo Scenario (serialize/deserialize json use only).
22  *
23  * @author Tim Roberts - Initial contribution
24  */
25 @NonNullByDefault
26 public class NeeoScenario {
27
28     /** The scenario name */
29     @Nullable
30     private String name;
31
32     /** The main device key */
33     @Nullable
34     private String mainDeviceKey;
35
36     /** The volume device key */
37     @Nullable
38     private String volumeDeviceKey;
39
40     /** The scenario key */
41     @Nullable
42     private String key;
43
44     /** Whether the scenario is pending configuration */
45     private boolean configured;
46
47     /** The associated room key */
48     @Nullable
49     private String roomKey;
50
51     /** The associated room name */
52     @Nullable
53     private String roomName;
54
55     /** The devices that make up the scenario */
56     private String @Nullable [] devices;
57
58     // may be used in the future
59     // private final NeeoShortcut[] shortcuts;
60     // @Nullable private String[] deviceInputMacroNames;
61     // private final NeeoCapability[] capabilities;
62
63     /**
64      * Gets the scenario name
65      *
66      * @return the name
67      */
68     @Nullable
69     public String getName() {
70         return name;
71     }
72
73     /**
74      * Gets the main device key
75      *
76      * @return the main device key
77      */
78     @Nullable
79     public String getMainDeviceKey() {
80         return mainDeviceKey;
81     }
82
83     /**
84      * Gets the volume device key
85      *
86      * @return the volume device key
87      */
88     @Nullable
89     public String getVolumeDeviceKey() {
90         return volumeDeviceKey;
91     }
92
93     /**
94      * Gets the scenario key
95      *
96      * @return the key
97      */
98     @Nullable
99     public String getKey() {
100         return key;
101     }
102
103     /**
104      * Checks if the scenario is pending configuration
105      *
106      * @return true, if is configured
107      */
108     public boolean isConfigured() {
109         return configured;
110     }
111
112     /**
113      * Gets the associated room key
114      *
115      * @return the room key
116      */
117     @Nullable
118     public String getRoomKey() {
119         return roomKey;
120     }
121
122     /**
123      * Gets the associated room name
124      *
125      * @return the room name
126      */
127     @Nullable
128     public String getRoomName() {
129         return roomName;
130     }
131
132     /**
133      * Gets the devices
134      *
135      * @return the devices
136      */
137     @Nullable
138     public String[] getDevices() {
139         final String @Nullable [] localDevices = devices;
140         return localDevices == null ? new String[0] : localDevices;
141     }
142
143     @Override
144     public String toString() {
145         return "NeeoScenario [name=" + name + ", mainDeviceKey=" + mainDeviceKey + ", volumeDeviceKey="
146                 + volumeDeviceKey + ", key=" + key + ", configured=" + configured + ", roomKey=" + roomKey
147                 + ", roomName=" + roomName + ", devices=" + Arrays.toString(devices) + "]";
148     }
149 }