]> git.basschouten.com Git - openhab-addons.git/blob
213b868b2487377ab2f26aad0184d1f82d4e2c21
[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 io.swagger.v3.oas.annotations.media.Schema;
18
19 /**
20  * Changes to a current preset The contents of state and commands will be completely replaced if populated. Merging old
21  * and new updates seems too complicated and error prone.
22  **/
23 @Schema(description = "Changes to a current preset  The contents of state and commands will be completely replaced if populated. Merging old and new updates seems too complicated and error prone.")
24 public class PresetUpdate {
25
26     @Schema
27     /**
28      * Friendly name
29      **/
30     private String name;
31
32     @Schema
33     private PresetState state;
34
35     @Schema
36     private List<Command> commands = null;
37
38     /**
39      * Friendly name
40      *
41      * @return name
42      **/
43     public String getName() {
44         return name;
45     }
46
47     public void setName(String name) {
48         this.name = name;
49     }
50
51     public PresetUpdate name(String name) {
52         this.name = name;
53         return this;
54     }
55
56     /**
57      * Get state
58      *
59      * @return state
60      **/
61     public PresetState getState() {
62         return state;
63     }
64
65     public void setState(PresetState state) {
66         this.state = state;
67     }
68
69     public PresetUpdate state(PresetState state) {
70         this.state = state;
71         return this;
72     }
73
74     /**
75      * Get commands
76      *
77      * @return commands
78      **/
79     public List<Command> getCommands() {
80         return commands;
81     }
82
83     public void setCommands(List<Command> commands) {
84         this.commands = commands;
85     }
86
87     public PresetUpdate commands(List<Command> commands) {
88         this.commands = commands;
89         return this;
90     }
91
92     public PresetUpdate addCommandsItem(Command commandsItem) {
93         this.commands.add(commandsItem);
94         return this;
95     }
96
97     @Override
98     public String toString() {
99         StringBuilder sb = new StringBuilder();
100         sb.append("class PresetUpdate {\n");
101
102         sb.append("    name: ").append(toIndentedString(name)).append("\n");
103         sb.append("    state: ").append(toIndentedString(state)).append("\n");
104         sb.append("    commands: ").append(toIndentedString(commands)).append("\n");
105         sb.append("}");
106         return sb.toString();
107     }
108
109     /**
110      * Convert the given object to string with each line indented by 4 spaces
111      * (except the first line).
112      */
113     private static String toIndentedString(Object o) {
114         if (o == null) {
115             return "null";
116         }
117         return o.toString().replace("\n", "\n    ");
118     }
119 }