]> git.basschouten.com Git - openhab-addons.git/blob
09cff82b7801ab3b22713fe764219dcb04f4090f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.energidataservice.internal.api;
14
15 import java.util.Collection;
16 import java.util.Set;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19
20 /**
21  * Filter for the DatahubPricelist dataset.
22  * 
23  * @author Jacob Laursen - Initial contribution
24  */
25 @NonNullByDefault
26 public class DatahubTariffFilter {
27
28     private final Set<ChargeTypeCode> chargeTypeCodes;
29     private final Set<String> notes;
30     private final DateQueryParameter start;
31     private final DateQueryParameter end;
32
33     public DatahubTariffFilter(DatahubTariffFilter filter, DateQueryParameter start) {
34         this(filter, start, DateQueryParameter.EMPTY);
35     }
36
37     public DatahubTariffFilter(DatahubTariffFilter filter, DateQueryParameter start, DateQueryParameter end) {
38         this(filter.chargeTypeCodes, filter.notes, start, end);
39     }
40
41     public DatahubTariffFilter(Set<ChargeTypeCode> chargeTypeCodes, Set<String> notes) {
42         this(chargeTypeCodes, notes, DateQueryParameter.EMPTY);
43     }
44
45     public DatahubTariffFilter(Set<ChargeTypeCode> chargeTypeCodes, Set<String> notes, DateQueryParameter start) {
46         this(chargeTypeCodes, notes, start, DateQueryParameter.EMPTY);
47     }
48
49     public DatahubTariffFilter(Set<ChargeTypeCode> chargeTypeCodes, Set<String> notes, DateQueryParameter start,
50             DateQueryParameter end) {
51         this.chargeTypeCodes = chargeTypeCodes;
52         this.notes = notes;
53         this.start = start;
54         this.end = end;
55     }
56
57     public Collection<String> getChargeTypeCodesAsStrings() {
58         return chargeTypeCodes.stream().map(c -> c.toString()).toList();
59     }
60
61     public Collection<String> getNotes() {
62         return notes;
63     }
64
65     public DateQueryParameter getStart() {
66         return start;
67     }
68
69     public DateQueryParameter getEnd() {
70         return end;
71     }
72 }