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.surepetcare.internal.dto;
15 import java.math.BigDecimal;
16 import java.time.LocalDate;
17 import java.util.Arrays;
20 import org.eclipse.jdt.annotation.NonNull;
22 import com.google.gson.annotations.SerializedName;
25 * The {@link SurePetcarePet} is a DTO class used to represent a pet. It's used to deserialize JSON API results.
27 * @author Rene Scherer - Initial contribution
29 public class SurePetcarePet extends SurePetcareBaseObject {
31 public enum PetGender {
33 UNKNONWN(-1, "Unknown"),
37 public final Integer id;
38 public final String name;
40 private PetGender(int id, String name) {
45 public static PetGender findByTypeId(final int id) {
46 return Arrays.stream(values()).filter(value -> value.id.equals(id)).findFirst().orElse(UNKNONWN);
50 public enum PetSpecies {
52 UNKNONWN(0, "Unknown"),
56 public final Integer id;
57 public final String name;
59 private PetSpecies(int id, String name) {
64 public static PetSpecies findByTypeId(final int id) {
65 return Arrays.stream(values()).filter(value -> value.id.equals(id)).findFirst().orElse(UNKNONWN);
69 public String name = "";
71 @SerializedName("gender")
72 public Integer genderId;
73 public LocalDate dateOfBirth;
74 public BigDecimal weight;
75 public String comments;
76 public Long householdId;
77 public Integer breedId;
79 public Integer speciesId;
81 public SurePetcarePhoto photo;
83 public SurePetcarePetStatus status = new SurePetcarePetStatus();
86 public String toString() {
87 return "Pet [id=" + id + ", name=" + name + ", tagId=" + tagId + "]";
91 public @NonNull Map<@NonNull String, @NonNull String> getThingProperties() {
93 Map<@NonNull String, @NonNull String> properties = super.getThingProperties();
94 properties.put("householdId", householdId.toString());