]> git.basschouten.com Git - openhab-addons.git/blob
0c1a8882b2ddeed54ee498f6e123c286fa13da3f
[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.ecobee.internal.enums;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 import com.google.gson.annotations.SerializedName;
19
20 /**
21  * The {@link AckType} represents the types of alert acknowledgements.
22  *
23  * @author Mark Hilbush - Initial contribution
24  */
25 @NonNullByDefault
26 public enum AckType {
27
28     @SerializedName("accept")
29     ACCEPT("accept"),
30
31     @SerializedName("decline")
32     DECLINE("decline"),
33
34     @SerializedName("defer")
35     DEFER("defer"),
36
37     @SerializedName("unacknowledged")
38     UNACKNOWLEDGED("unacknowledged");
39
40     private final String type;
41
42     private AckType(String type) {
43         this.type = type;
44     }
45
46     public static AckType forValue(@Nullable String v) {
47         if (v != null) {
48             for (AckType at : AckType.values()) {
49                 if (at.type.equals(v)) {
50                     return at;
51                 }
52             }
53         }
54         throw new IllegalArgumentException("Invalid or null ack type: " + v);
55     }
56
57     @Override
58     public String toString() {
59         return this.type;
60     }
61 }