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.windcentrale.internal.dto;
15 import java.util.Arrays;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
21 * Enumerates the Windcentrale windmills. The project codes are used in API requests and responses.
22 * The other details are used as Thing properties.
24 * @author Wouter Born - Initial contribution
27 public enum Windmill {
29 DE_GROTE_GEERT(1, "WND-GG", "De Grote Geert", 9910, "Enercon E-70", 2008, "Delfzijl", "Groningen",
30 "53.280605, 6.955141", "https://www.windcentrale.nl/molens/de-grote-geert-2/"),
31 DE_JONGE_HELD(2, "WND-JH", "De Jonge Held", 10154, "Enercon E-70", 2008, "Delfzijl", "Groningen",
32 "53.277648, 6.954906", "https://www.windcentrale.nl/molens/de-jonge-held/"),
33 HET_RODE_HERT(31, "WND-RH", "Het Rode Hert", 6648, "Vestas V80", 2005, "Culemborg", "Gelderland",
34 "51.935831, 5.192109", "https://www.windcentrale.nl/molens/het-rode-hert/"),
35 DE_RANKE_ZWAAN(41, "WND-RZ", "De Ranke Zwaan", 6164, "Vestas V80", 2005, "Culemborg", "Gelderland",
36 "51.934915, 5.19989", "https://www.windcentrale.nl/molens/de-ranke-zwaan-2/"),
37 DE_WITTE_JUFFER(51, "WND-WJ", "De Witte Juffer", 5721, "Vestas V80", 2005, "Culemborg", "Gelderland",
38 "51.935178, 5.195860", "https://www.windcentrale.nl/molens/de-witte-juffer/"),
39 DE_BONTE_HEN(111, "WND-BH", "De Bonte Hen", 5579, "Vestas V52", 2009, "Burgerbrug", "Noord-Holland",
40 "52.757051, 4.684678", "https://www.windcentrale.nl/molens/de-bonte-hen-2/"),
41 DE_TROUWE_WACHTER(121, "WND-TW", "De Trouwe Wachter", 5602, "Vestas V52", 2009, "Burgerbrug", "Noord-Holland",
42 "52.758745, 4.686041", "https://www.windcentrale.nl/molens/de-trouwe-wachter-2/"),
43 DE_BLAUWE_REIGER(131, "WND-BR", "De Blauwe Reiger", 5534, "Vestas V52", 2009, "Burgerbrug", "Noord-Holland",
44 "52.760482, 4.687438", "https://www.windcentrale.nl/molens/de-blauwe-reiger/"),
45 DE_VIER_WINDEN(141, "WND-VW", "De Vier Winden", 5512, "Vestas V52", 2009, "Burgerbrug", "Noord-Holland",
46 "52.762219, 4.688837", "https://www.windcentrale.nl/molens/de-vier-winden-2/"),
47 DE_BOERENZWALUW(201, "WND-BZ", "De Boerenzwaluw", 3000, "Enercon E-44", 2015, "Burum", "Friesland",
48 "53.265572, 6.213929", "https://www.windcentrale.nl/molens/de-boerenzwaluw/"),
49 HET_VLIEGENDE_HERT(211, "WND-VH", "Het Vliegend Hert", 10000, "Lagerwey L82", 2019, "Rouveen", "Overijssel",
50 "52.595422, 6.223335", "https://www.windcentrale.nl/molens/het-vliegend-hert/");
53 private final String projectCode;
54 private final String name;
55 private final int totalShares;
56 private final String type;
57 private final int buildYear;
58 private final String municipality;
59 private final String province;
60 private final String coordinates;
61 private final String detailsUrl;
63 Windmill(int id, String projectCode, String name, int totalShares, String type, int buildYear, String municipality,
64 String province, String coordinates, String detailsUrl) {
66 this.projectCode = projectCode;
68 this.totalShares = totalShares;
70 this.buildYear = buildYear;
71 this.municipality = municipality;
72 this.province = province;
73 this.coordinates = coordinates;
74 this.detailsUrl = detailsUrl;
81 public String getProjectCode() {
85 public String getName() {
89 public int getTotalShares() {
93 public String getType() {
97 public int getBuildYear() {
101 public String getMunicipality() {
105 public String getProvince() {
109 public String getCoordinates() {
113 public String getDetailsUrl() {
118 public String toString() {
122 public static @Nullable Windmill fromName(String name) {
123 return Arrays.stream(values()) //
124 .filter(windmill -> windmill.name.equals(name)) //
125 .findFirst().orElse(null);
128 public static @Nullable Windmill fromProjectCode(String projectCode) {
129 return Arrays.stream(values()) //
130 .filter(windmill -> windmill.projectCode.equals(projectCode)) //
131 .findFirst().orElse(null);