]> git.basschouten.com Git - openhab-addons.git/blob
68310766c62be3b8c148480692c7a69d40a07c32
[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.amplipi.internal.model;
14
15 import java.util.List;
16
17 import com.fasterxml.jackson.annotation.JsonProperty;
18
19 /**
20  * A PA-like Announcement IF no zones or groups are specified, all available zones are used
21  **/
22 public class Announcement {
23
24     /**
25      * URL to media to play as the announcement
26      **/
27     private String media;
28
29     /**
30      * Output volume in dB
31      **/
32     private Integer vol = -40;
33
34     /**
35      * Source to announce with
36      **/
37     private Integer sourceId = 3;
38
39     /**
40      * Set of zone ids belonging to a group
41      **/
42     private List<Integer> zones = null;
43
44     /**
45      * List of group ids
46      **/
47     private List<Integer> groups = null;
48
49     /**
50      * URL to media to play as the announcement
51      *
52      * @return media
53      **/
54     @JsonProperty("media")
55     public String getMedia() {
56         return media;
57     }
58
59     public void setMedia(String media) {
60         this.media = media;
61     }
62
63     public Announcement media(String media) {
64         this.media = media;
65         return this;
66     }
67
68     /**
69      * Output volume in dB
70      * minimum: -79
71      * maximum: 0
72      *
73      * @return vol
74      **/
75     @JsonProperty("vol")
76     public Integer getVol() {
77         return vol;
78     }
79
80     public void setVol(Integer vol) {
81         this.vol = vol;
82     }
83
84     public Announcement vol(Integer vol) {
85         this.vol = vol;
86         return this;
87     }
88
89     /**
90      * Source to announce with
91      * minimum: 0
92      * maximum: 3
93      *
94      * @return sourceId
95      **/
96     @JsonProperty("source_id")
97     public Integer getSourceId() {
98         return sourceId;
99     }
100
101     public void setSourceId(Integer sourceId) {
102         this.sourceId = sourceId;
103     }
104
105     public Announcement sourceId(Integer sourceId) {
106         this.sourceId = sourceId;
107         return this;
108     }
109
110     /**
111      * Set of zone ids belonging to a group
112      *
113      * @return zones
114      **/
115     @JsonProperty("zones")
116     public List<Integer> getZones() {
117         return zones;
118     }
119
120     public void setZones(List<Integer> zones) {
121         this.zones = zones;
122     }
123
124     public Announcement zones(List<Integer> zones) {
125         this.zones = zones;
126         return this;
127     }
128
129     public Announcement addZonesItem(Integer zonesItem) {
130         this.zones.add(zonesItem);
131         return this;
132     }
133
134     /**
135      * List of group ids
136      *
137      * @return groups
138      **/
139     @JsonProperty("groups")
140     public List<Integer> getGroups() {
141         return groups;
142     }
143
144     public void setGroups(List<Integer> groups) {
145         this.groups = groups;
146     }
147
148     public Announcement groups(List<Integer> groups) {
149         this.groups = groups;
150         return this;
151     }
152
153     public Announcement addGroupsItem(Integer groupsItem) {
154         this.groups.add(groupsItem);
155         return this;
156     }
157
158     @Override
159     public String toString() {
160         StringBuilder sb = new StringBuilder();
161         sb.append("class Announcement {\n");
162
163         sb.append("    media: ").append(toIndentedString(media)).append("\n");
164         sb.append("    vol: ").append(toIndentedString(vol)).append("\n");
165         sb.append("    sourceId: ").append(toIndentedString(sourceId)).append("\n");
166         sb.append("    zones: ").append(toIndentedString(zones)).append("\n");
167         sb.append("    groups: ").append(toIndentedString(groups)).append("\n");
168         sb.append("}");
169         return sb.toString();
170     }
171
172     /**
173      * Convert the given object to string with each line indented by 4 spaces
174      * (except the first line).
175      */
176     private static String toIndentedString(Object o) {
177         if (o == null) {
178             return "null";
179         }
180         return o.toString().replace("\n", "\n    ");
181     }
182 }