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.vigicrues.internal.dto.vigicrues;
15 import static org.openhab.binding.vigicrues.internal.VigiCruesBindingConstants.*;
17 import java.util.HashMap;
18 import java.util.List;
19 import java.util.Locale;
22 import com.google.gson.annotations.SerializedName;
25 * The {@link CdStationHydro} is the Java class used to map the JSON
26 * response to a vigicrue api endpoint request.
28 * @author Gaël L'hopital - Initial contribution
30 public class CdStationHydro {
32 public class PereBoitEntVigiCru {
33 @SerializedName("CdEntVigiCru")
34 public String cdEntVigiCru;
37 public class CruesHistorique {
38 @SerializedName("LbUsuel")
40 @SerializedName("ValHauteur")
41 private double height;
42 @SerializedName("ValDebit")
45 public Map<String, String> getDescription() {
46 Map<String, String> result = new HashMap<>();
48 result.put(String.format("%s %s (%s)", FLOOD, HEIGHT, name),
49 String.format(Locale.US, "%.2f m", height));
52 result.put(String.format("%s %s (%s)", FLOOD, FLOW, name), String.format(Locale.US, "%.2f m³/s", flow));
58 public class VigilanceCrues {
59 @SerializedName("PereBoitEntVigiCru")
60 public PereBoitEntVigiCru pereBoitEntVigiCru;
61 @SerializedName("CruesHistoriques")
62 public List<CruesHistorique> cruesHistoriques;
64 * Currently unused, maybe interesting in the future
66 * @SerializedName("StationPrevision")
67 * public String stationPrevision;
69 * @SerializedName("Photo")
70 * public String photo;
72 * @SerializedName("ZoomInitial")
73 * public String zoomInitial;
77 @SerializedName("VigilanceCrues")
78 public VigilanceCrues vigilanceCrues;
80 * Currently unused, maybe interesting in the future
82 * @SerializedName("VersionFlux")
83 * public String versionFlux;
85 * @SerializedName("CdStationHydro")
86 * public String cdStationHydro;
88 * @SerializedName("LbStationHydro")
89 * public String lbStationHydro;
91 * @SerializedName("LbCoursEau")
92 * public String lbCoursEau;
94 * @SerializedName("CdStationHydroAncienRef")
95 * public String cdStationHydroAncienRef;
97 * @SerializedName("CdCommune")
98 * public String cdCommune;
100 * @SerializedName("error_msg")
101 * public String errorMsg;