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.groupepsa.internal.rest.api.dto;
15 import java.time.ZonedDateTime;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
21 import com.google.gson.annotations.SerializedName;
24 * @author Arjan Mels - Initial contribution
27 public class VehicleStatus {
29 private @Nullable ZonedDateTime updatedAt;
30 @SerializedName("_embedded")
31 private @Nullable Embedded embedded;
32 private @Nullable Battery battery;
33 private @Nullable DoorsState doorsState;
34 private @Nullable List<Energy> energy = null;
35 private @Nullable Environment environment;
36 private @Nullable Ignition ignition;
37 private @Nullable Kinetic kinetic;
38 @SerializedName("timed.odometer")
39 private @Nullable Odometer odometer;
40 private @Nullable Position lastPosition;
41 private @Nullable Preconditionning preconditionning;
42 private @Nullable Privacy privacy;
43 private @Nullable Safety safety;
44 private @Nullable Service service;
46 private static class Embedded {
47 private @Nullable Extension extension;
50 public String toString() {
51 return new ToStringBuilder(this).append("extension", extension).toString();
55 private static class Extension {
56 private @Nullable Kinetic kinetic;
57 private @Nullable Odometer odometer;
60 public String toString() {
61 return new ToStringBuilder(this).append("kinetic", kinetic).append("odometer", odometer).toString();
65 public @Nullable Kinetic getKinetic() {
66 if (kinetic != null) {
69 final Embedded finalEmbedded = embedded;
70 if (finalEmbedded != null) {
71 final Extension finalExtension = finalEmbedded.extension;
72 if (finalExtension != null) {
73 return finalExtension.kinetic;
80 public @Nullable Odometer getOdometer() {
81 if (odometer != null) {
84 Embedded finalEmbedded = embedded;
85 if (finalEmbedded != null) {
86 final Extension finalExtension = finalEmbedded.extension;
87 if (finalExtension != null) {
88 return finalExtension.odometer;
95 public @Nullable ZonedDateTime getUpdatedAt() {
99 public @Nullable Battery getBattery() {
103 public @Nullable DoorsState getDoorsState() {
107 public @Nullable List<Energy> getEnergy() {
111 public @Nullable Environment getEnvironment() {
115 public @Nullable Ignition getIgnition() {
119 public @Nullable Position getLastPosition() {
123 public @Nullable Preconditionning getPreconditionning() {
124 return preconditionning;
127 public @Nullable Privacy getPrivacy() {
131 public @Nullable Safety getSafety() {
135 public @Nullable Service getService() {
140 public String toString() {
141 return new ToStringBuilder(this).append("updatedAt", updatedAt).append("_embedded", embedded)
142 .append("battery", battery).append("doorsState", doorsState).append("energy", energy)
143 .append("environment", environment).append("ignition", ignition).append("kinetic", kinetic)
144 .append("odometer", odometer).append("lastPosition", lastPosition)
145 .append("preconditionning", preconditionning).append("privacy", privacy).append("safety", safety)
146 .append("service", service).toString();