]> git.basschouten.com Git - openhab-addons.git/blob
4be24caf97773158960414e20f2fb0219c4cbe79
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.amplipi.internal.model;
14
15 import java.util.LinkedHashSet;
16 import java.util.Set;
17
18 import com.google.gson.annotations.SerializedName;
19
20 import io.swagger.v3.oas.annotations.media.Schema;
21
22 /**
23  * A group of zones that can share the same audio input and be controlled as a group ie. Updstairs. Volume, mute, and
24  * source_id fields are aggregates of the member zones.
25  **/
26 @Schema(description = "A group of zones that can share the same audio input and be controlled as a group ie. Updstairs.  Volume, mute, and source_id fields are aggregates of the member zones.")
27 public class Group {
28
29     @Schema
30     /**
31      * Unique identifier
32      **/
33     private Integer id;
34
35     @Schema(required = true)
36     /**
37      * Friendly name
38      **/
39     private String name;
40
41     @Schema
42     @SerializedName("source_id")
43     /**
44      * id of the connected source
45      **/
46     private Integer sourceId = 0;
47
48     @Schema(required = true)
49     /**
50      * Set of zones belonging to a group
51      **/
52     private Set<Integer> zones = new LinkedHashSet<Integer>();
53
54     @Schema
55     /**
56      * Set to true if output is all zones muted
57      **/
58     private Boolean mute = true;
59
60     @Schema
61     @SerializedName("vol_delta")
62     /**
63      * Average utput volume in dB
64      **/
65     private Integer volDelta = -79;
66
67     /**
68      * Unique identifier
69      *
70      * @return id
71      **/
72     public Integer getId() {
73         return id;
74     }
75
76     public void setId(Integer id) {
77         this.id = id;
78     }
79
80     public Group id(Integer id) {
81         this.id = id;
82         return this;
83     }
84
85     /**
86      * Friendly name
87      *
88      * @return name
89      **/
90     public String getName() {
91         return name;
92     }
93
94     public void setName(String name) {
95         this.name = name;
96     }
97
98     public Group name(String name) {
99         this.name = name;
100         return this;
101     }
102
103     /**
104      * id of the connected source
105      * minimum: 0
106      * maximum: 3
107      *
108      * @return sourceId
109      **/
110     public Integer getSourceId() {
111         return sourceId;
112     }
113
114     public void setSourceId(Integer sourceId) {
115         this.sourceId = sourceId;
116     }
117
118     public Group sourceId(Integer sourceId) {
119         this.sourceId = sourceId;
120         return this;
121     }
122
123     /**
124      * Set of zones belonging to a group
125      *
126      * @return zones
127      **/
128     public Set<Integer> getZones() {
129         return zones;
130     }
131
132     public void setZones(Set<Integer> zones) {
133         this.zones = zones;
134     }
135
136     public Group zones(Set<Integer> zones) {
137         this.zones = zones;
138         return this;
139     }
140
141     public Group addZonesItem(Integer zonesItem) {
142         this.zones.add(zonesItem);
143         return this;
144     }
145
146     /**
147      * Set to true if output is all zones muted
148      *
149      * @return mute
150      **/
151     public Boolean getMute() {
152         return mute;
153     }
154
155     public void setMute(Boolean mute) {
156         this.mute = mute;
157     }
158
159     public Group mute(Boolean mute) {
160         this.mute = mute;
161         return this;
162     }
163
164     /**
165      * Average utput volume in dB
166      * minimum: -79
167      * maximum: 0
168      *
169      * @return volDelta
170      **/
171     public Integer getVolDelta() {
172         return volDelta;
173     }
174
175     public void setVolDelta(Integer volDelta) {
176         this.volDelta = volDelta;
177     }
178
179     public Group volDelta(Integer volDelta) {
180         this.volDelta = volDelta;
181         return this;
182     }
183
184     @Override
185     public String toString() {
186         StringBuilder sb = new StringBuilder();
187         sb.append("class Group {\n");
188
189         sb.append("    id: ").append(toIndentedString(id)).append("\n");
190         sb.append("    name: ").append(toIndentedString(name)).append("\n");
191         sb.append("    sourceId: ").append(toIndentedString(sourceId)).append("\n");
192         sb.append("    zones: ").append(toIndentedString(zones)).append("\n");
193         sb.append("    mute: ").append(toIndentedString(mute)).append("\n");
194         sb.append("    volDelta: ").append(toIndentedString(volDelta)).append("\n");
195         sb.append("}");
196         return sb.toString();
197     }
198
199     /**
200      * Convert the given object to string with each line indented by 4 spaces
201      * (except the first line).
202      */
203     private static String toIndentedString(Object o) {
204         if (o == null) {
205             return "null";
206         }
207         return o.toString().replace("\n", "\n    ");
208     }
209 }