2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.ecovacs.internal.api.impl.dto.response.deviceapi.json;
15 import org.openhab.binding.ecovacs.internal.api.model.CleanMode;
17 import com.google.gson.Gson;
18 import com.google.gson.annotations.SerializedName;
21 * @author Danny Baumann - Initial contribution
23 public class CleanReport {
24 @SerializedName("trigger")
25 public String trigger; // app, workComplete, ...?
26 @SerializedName("state")
28 @SerializedName("cleanState")
29 public CleanStateReport cleanState;
31 public static class CleanStateReport {
32 @SerializedName("router")
33 public String router; // plan, ...?
34 @SerializedName("type")
36 @SerializedName("motionState")
37 public String motionState;
38 @SerializedName("content")
39 public String areaDefinition;
42 public CleanMode determineCleanMode(Gson gson) {
43 final String modeValue;
44 if (cleanState != null) {
45 if ("working".equals(cleanState.motionState)) {
46 modeValue = cleanState.type;
48 modeValue = cleanState.motionState;
53 return gson.fromJson(modeValue, CleanMode.class);