]> git.basschouten.com Git - openhab-addons.git/blob
c68bee50deda7f2d0bcf92242ffa7ea1431a3ccb
[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 /**
18  * @author Danny Baumann - Initial contribution
19  */
20 @NonNullByDefault
21 public enum SpotAreaType {
22     LIVING_ROOM(1),
23     DINING_ROOM(2),
24     BEDROOM(3),
25     OFFICE(4),
26     KITCHEN(5),
27     BATHROOM(6),
28     LAUNDRY_ROOM(7),
29     LOUNGE(8),
30     STORAGE_ROOM(9),
31     CHILDS_ROOM(10),
32     SUN_ROOM(11),
33     CORRIDOR(12),
34     BALCONY(13),
35     GYM(14);
36
37     private final int type;
38
39     private SpotAreaType(int type) {
40         this.type = type;
41     }
42
43     public SpotAreaType fromApiResponse(String response) throws NumberFormatException, IllegalArgumentException {
44         int id = Integer.parseInt(response);
45         for (SpotAreaType t : values()) {
46             if (t.type == id) {
47                 return t;
48             }
49         }
50         throw new IllegalArgumentException("Unknown spot area type " + response);
51     }
52 }