]> git.basschouten.com Git - openhab-addons.git/blob
764632082eedbe62657a644a26feb2fa5ecea064
[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.surepetcare.internal.dto;
14
15 import java.util.List;
16
17 import org.openhab.binding.surepetcare.internal.utils.SurePetcareDeviceCurfewListTypeAdapterFactory;
18
19 import com.google.gson.annotations.JsonAdapter;
20 import com.google.gson.annotations.SerializedName;
21
22 /**
23  * The {@link SurePetcareDeviceControl} class is used to serialize a JSON object to control certain parameters of a
24  * device (e.g. locking mode, curfew etc.).
25  *
26  * @author Rene Scherer - Initial contribution
27  * @author Holger Eisold - Added pet feeder status
28  */
29 public class SurePetcareDeviceControl {
30
31     @SerializedName("locking")
32     public Integer lockingModeId;
33     public Boolean fastPolling;
34     @SerializedName("led_mode")
35     public Integer ledModeId;
36     @SerializedName("pairing_mode")
37     public Integer pairingModeId;
38     public Bowls bowls;
39     public Lid lid;
40     @SerializedName("training_mode")
41     public Integer trainingModeId;
42     @SerializedName("curfew")
43     @JsonAdapter(SurePetcareDeviceCurfewListTypeAdapterFactory.class)
44     public SurePetcareDeviceCurfewList curfewList;
45
46     public class Bowls {
47         public class BowlSettings {
48             @SerializedName("food_type")
49             public Integer foodId;
50             @SerializedName("target")
51             public Integer targetId;
52
53             public BowlSettings(Integer foodId, Integer targetId) {
54                 this.foodId = foodId;
55                 this.targetId = targetId;
56             }
57         }
58
59         @SerializedName("settings")
60         public List<BowlSettings> bowlSettings;
61         @SerializedName("type")
62         public Integer bowlId;
63
64         public Bowls(List<BowlSettings> bowlSettings, Integer bowlId) {
65             this.bowlSettings = bowlSettings;
66             this.bowlId = bowlId;
67         }
68     }
69
70     public class Lid {
71         @SerializedName("close_delay")
72         public Integer closeDelayId;
73
74         public Lid(Integer closeDelayId) {
75             this.closeDelayId = closeDelayId;
76         }
77     }
78
79     @Override
80     public String toString() {
81         StringBuilder builder = new StringBuilder("SurePetcareDeviceControl [");
82         builder.append("lockingModeId=").append(lockingModeId);
83         builder.append(", fastPolling=").append(fastPolling);
84         builder.append(", ledModeId=").append(ledModeId);
85         builder.append(", pairingModeId=").append(pairingModeId);
86         builder.append(", trainingModeId=").append(trainingModeId);
87         builder.append(", curfew=").append(curfewList);
88         return builder.toString();
89     }
90 }