]> git.basschouten.com Git - openhab-addons.git/blob
3abd3b0d0b01c095f7e85625cdf0577a2edc720c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * The {@link HoldType} represents the possible hold types.
21  *
22  * @author John Cocula - Initial contribution
23  * @author Mark Hilbush - Adapt for OH2/3
24  */
25 @NonNullByDefault
26 public enum HoldType {
27
28     /**
29      * Use the provided startDate, startTime, endDate and endTime for the event.
30      * If start date/time is not provided, it will be assumed to be right now.
31      * End date/time is required.
32      */
33     @SerializedName("dateTime")
34     DATE_TIME("dateTime"),
35
36     /**
37      * The end date/time will be set to the next climate transition in the program.
38      */
39     @SerializedName("nextTransition")
40     NEXT_TRANSITION("nextTransition"),
41
42     /**
43      * The hold will not end and require to be cancelled explicitly.
44      */
45     @SerializedName("indefinite")
46     INDEFINITE("indefinite"),
47
48     /**
49      * Use the value in the holdHours parameter to set the end date/time for the event.
50      */
51     @SerializedName("holdHours")
52     HOLD_HOURS("holdHours");
53
54     private final String type;
55
56     private HoldType(final String type) {
57         this.type = type;
58     }
59
60     public static HoldType forValue(String v) {
61         for (HoldType ht : HoldType.values()) {
62             if (ht.type.equals(v)) {
63                 return ht;
64             }
65         }
66         throw new IllegalArgumentException("Invalid hold type: " + v);
67     }
68
69     @Override
70     public String toString() {
71         return this.type;
72     }
73 }