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 CleanReportV2 {
24 @SerializedName("trigger")
25 public String trigger; // app, workComplete, ...?
26 @SerializedName("state")
28 @SerializedName("cleanState")
29 public CleanStateReportV2 cleanState;
31 public static class CleanStateReportV2 {
32 @SerializedName("router")
33 public String router; // plan, ...?
34 @SerializedName("motionState")
35 public String motionState;
36 @SerializedName("content")
37 public CleanStateReportV2Content content;
40 public static class CleanStateReportV2Content {
41 @SerializedName("type")
43 @SerializedName("value")
44 public String areaDefinition;
47 public CleanMode determineCleanMode(Gson gson) {
48 final String modeValue;
49 if ("clean".equals(state) && cleanState != null) {
50 if ("working".equals(cleanState.motionState)) {
51 modeValue = cleanState.content.type;
53 modeValue = cleanState.motionState;
58 return gson.fromJson(modeValue, CleanMode.class);