]> git.basschouten.com Git - openhab-addons.git/blob
b2176cc1b1fda83343adc9b8b51d61567f1c4940
[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.google.gson.annotations.SerializedName;
18
19 import io.swagger.v3.oas.annotations.media.Schema;
20
21 /**
22  * A partial controller configuration the can be loaded on demand. In addition to most of the configuration found in
23  * Status, this can contain commands as well that configure the state of different streaming services.
24  **/
25 @Schema(description = "A partial controller configuration the can be loaded on demand. In addition to most of the configuration found in Status, this can contain commands as well that configure the state of different streaming services.")
26 public class Preset {
27
28     @Schema
29     /**
30      * Unique identifier
31      **/
32     private Integer id;
33
34     @Schema(required = true)
35     /**
36      * Friendly name
37      **/
38     private String name;
39
40     @Schema(required = true)
41     private PresetState state;
42
43     @Schema
44     private List<Command> commands = null;
45
46     @Schema
47     @SerializedName("last_used")
48     private Integer lastUsed;
49
50     /**
51      * Unique identifier
52      *
53      * @return id
54      **/
55     public Integer getId() {
56         return id;
57     }
58
59     public void setId(Integer id) {
60         this.id = id;
61     }
62
63     public Preset id(Integer id) {
64         this.id = id;
65         return this;
66     }
67
68     /**
69      * Friendly name
70      *
71      * @return name
72      **/
73     public String getName() {
74         return name;
75     }
76
77     public void setName(String name) {
78         this.name = name;
79     }
80
81     public Preset name(String name) {
82         this.name = name;
83         return this;
84     }
85
86     /**
87      * Get state
88      *
89      * @return state
90      **/
91     public PresetState getState() {
92         return state;
93     }
94
95     public void setState(PresetState state) {
96         this.state = state;
97     }
98
99     public Preset state(PresetState state) {
100         this.state = state;
101         return this;
102     }
103
104     /**
105      * Get commands
106      *
107      * @return commands
108      **/
109     public List<Command> getCommands() {
110         return commands;
111     }
112
113     public void setCommands(List<Command> commands) {
114         this.commands = commands;
115     }
116
117     public Preset commands(List<Command> commands) {
118         this.commands = commands;
119         return this;
120     }
121
122     public Preset addCommandsItem(Command commandsItem) {
123         this.commands.add(commandsItem);
124         return this;
125     }
126
127     /**
128      * Get lastUsed
129      *
130      * @return lastUsed
131      **/
132     public Integer getLastUsed() {
133         return lastUsed;
134     }
135
136     public void setLastUsed(Integer lastUsed) {
137         this.lastUsed = lastUsed;
138     }
139
140     public Preset lastUsed(Integer lastUsed) {
141         this.lastUsed = lastUsed;
142         return this;
143     }
144
145     @Override
146     public String toString() {
147         StringBuilder sb = new StringBuilder();
148         sb.append("class Preset {\n");
149
150         sb.append("    id: ").append(toIndentedString(id)).append("\n");
151         sb.append("    name: ").append(toIndentedString(name)).append("\n");
152         sb.append("    state: ").append(toIndentedString(state)).append("\n");
153         sb.append("    commands: ").append(toIndentedString(commands)).append("\n");
154         sb.append("    lastUsed: ").append(toIndentedString(lastUsed)).append("\n");
155         sb.append("}");
156         return sb.toString();
157     }
158
159     /**
160      * Convert the given object to string with each line indented by 4 spaces
161      * (except the first line).
162      */
163     private static String toIndentedString(Object o) {
164         if (o == null) {
165             return "null";
166         }
167         return o.toString().replace("\n", "\n    ");
168     }
169 }