]> git.basschouten.com Git - openhab-addons.git/blob
12992e1b866bb9c06aa9f837f59b2e9b3d4b615e
[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.ecovacs.internal.api.model;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * @author Johannes Ptaszyk - Initial contribution
21  */
22 @NonNullByDefault
23 public enum SuctionPower {
24     @SerializedName("standard")
25     NORMAL,
26     @SerializedName("strong")
27     HIGH,
28     HIGHER,
29     SILENT;
30
31     public static SuctionPower fromJsonValue(int value) {
32         switch (value) {
33             case 1000:
34                 return SILENT;
35             case 1:
36                 return HIGH;
37             case 2:
38                 return HIGHER;
39             default:
40                 return NORMAL;
41         }
42     }
43
44     public int toJsonValue() {
45         switch (this) {
46             case HIGH:
47                 return 1;
48             case HIGHER:
49                 return 2;
50             case SILENT:
51                 return 1000;
52             default: // NORMAL
53                 return 0;
54         }
55     }
56
57     public String toXmlValue() {
58         if (this == HIGH) {
59             return "strong";
60         }
61         return "standard";
62     }
63 }