]> git.basschouten.com Git - openhab-addons.git/blob
2393c890e6d2aae2d0e8ce0be1c763a97cd7cc61
[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.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 dateQueryParameter;
31
32     public DatahubTariffFilter(DatahubTariffFilter filter, DateQueryParameter dateQueryParameter) {
33         this(filter.chargeTypeCodes, filter.notes, dateQueryParameter);
34     }
35
36     public DatahubTariffFilter(Set<ChargeTypeCode> chargeTypeCodes, Set<String> notes) {
37         this(chargeTypeCodes, notes, DateQueryParameter.EMPTY);
38     }
39
40     public DatahubTariffFilter(Set<ChargeTypeCode> chargeTypeCodes, Set<String> notes,
41             DateQueryParameter dateQueryParameter) {
42         this.chargeTypeCodes = chargeTypeCodes;
43         this.notes = notes;
44         this.dateQueryParameter = dateQueryParameter;
45     }
46
47     public Collection<String> getChargeTypeCodesAsStrings() {
48         return chargeTypeCodes.stream().map(c -> c.toString()).toList();
49     }
50
51     public Collection<String> getNotes() {
52         return notes;
53     }
54
55     public DateQueryParameter getDateQueryParameter() {
56         return dateQueryParameter;
57     }
58 }