]> git.basschouten.com Git - openhab-addons.git/blob
110b4a631a8ed697024e949a7fb13d13046568df
[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.groupepsa.internal.rest.api.dto;
14
15 import java.time.ZonedDateTime;
16 import java.util.List;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 import com.google.gson.annotations.SerializedName;
22
23 /**
24  * @author Arjan Mels - Initial contribution
25  */
26 @NonNullByDefault
27 public class User {
28     private @Nullable String email;
29     private @Nullable String firstName;
30     private @Nullable String lastName;
31     @SerializedName("_embedded")
32     private @Nullable Embedded embedded;
33     private @Nullable ZonedDateTime createdAt;
34     private @Nullable ZonedDateTime updatedAt;
35
36     private static class Embedded {
37         private @Nullable List<Vehicle> vehicles;
38
39         @Override
40         public String toString() {
41             return new ToStringBuilder(this).append("vehicles", vehicles).toString();
42         }
43     }
44
45     public @Nullable String getEmail() {
46         return email;
47     }
48
49     public @Nullable String getLastName() {
50         return lastName;
51     }
52
53     public @Nullable String getFirstName() {
54         return firstName;
55     }
56
57     public @Nullable List<Vehicle> getVehicles() {
58         final Embedded resEmbedded = embedded;
59         if (resEmbedded != null) {
60             return resEmbedded.vehicles;
61         } else {
62             return null;
63         }
64     }
65
66     public @Nullable ZonedDateTime getCreatedAt() {
67         return createdAt;
68     }
69
70     public @Nullable ZonedDateTime getUpdatedAt() {
71         return updatedAt;
72     }
73
74     @Override
75     public String toString() {
76         return new ToStringBuilder(this).append("createdAt", createdAt).append("updatedAt", createdAt)
77                 .append("email", email).append("firstName", firstName).append("lastName", lastName)
78                 .append("vehicles", embedded != null ? embedded : null).toString();
79     }
80 }