]> git.basschouten.com Git - openhab-addons.git/blob
93d5dafdc94b287d512c6d7d0b87baafdebba895
[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.impl.dto.response.portal;
14
15 import java.util.List;
16
17 import org.openhab.binding.ecovacs.internal.api.model.CleanMode;
18
19 import com.google.gson.annotations.SerializedName;
20
21 /**
22  * @author Johannes Ptaszyk - Initial contribution
23  */
24 public class PortalCleanLogsResponse {
25     public static class LogRecord {
26         @SerializedName("ts")
27         public final long timestamp;
28
29         @SerializedName("last")
30         public final long duration;
31
32         public final int area;
33
34         public final String id;
35
36         public final String imageUrl;
37
38         public final CleanMode type;
39
40         // more possible fields: aiavoid (int), aitypes (list of something), stopReason (int)
41
42         LogRecord(long timestamp, long duration, int area, String id, String imageUrl, CleanMode type) {
43             this.timestamp = timestamp;
44             this.duration = duration;
45             this.area = area;
46             this.id = id;
47             this.imageUrl = imageUrl;
48             this.type = type;
49         }
50     }
51
52     @SerializedName("logs")
53     public final List<LogRecord> records;
54
55     @SerializedName("ret")
56     final String result;
57
58     PortalCleanLogsResponse(String result, List<LogRecord> records) {
59         this.result = result;
60         this.records = records;
61     }
62
63     public boolean wasSuccessful() {
64         return "ok".equals(result);
65     }
66 }