]> git.basschouten.com Git - openhab-addons.git/blob
b530d154aac040c5b386634bff146f0dc9b9eb02
[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.dto;
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 SelectionType} represents the valid selection types that can be passed in
22  * a SelectionDTO object.
23  *
24  * @author Mark Hilbush - Initial contribution
25  */
26 @NonNullByDefault
27 public enum SelectionType {
28
29     /*
30      * Select only those thermostats listed in the CSV match criteria. No spaces in the CSV string. There is a limit
31      * of 25 identifiers per request.
32      */
33     @SerializedName("thermostats")
34     THERMOSTATS("thermostats"),
35
36     /*
37      * When this is set the thermostats registered to the current user will be returned. This is only usable with
38      * Smart thermostats registered to a user. It does not work on EMS thermostats and may not be used by a Utility
39      * who is not the owner of thermostats.
40      */
41     @SerializedName("registered")
42     REGISTERED("registered"),
43
44     /*
45      * Selects all thermostats for a given management set defined by the Management/Utility account. This is only
46      * available to Management/Utility accounts. "/" is the root, represented by the "My Sets" set.
47      */
48     @SerializedName("managementSet")
49     MANAGEMENT_SET("managementSet");
50
51     private final String type;
52
53     private SelectionType(final String type) {
54         this.type = type;
55     }
56
57     public static SelectionType forValue(@Nullable String v) {
58         if (v != null) {
59             for (SelectionType at : SelectionType.values()) {
60                 if (at.type.equals(v)) {
61                     return at;
62                 }
63             }
64         }
65         throw new IllegalArgumentException("Invalid or null selection type: " + v);
66     }
67
68     @Override
69     public String toString() {
70         return this.type;
71     }
72 }