1 package de.dlr.shepard.neo4Core.io;
2
3 import de.dlr.shepard.influxDB.Timeseries;
4 import de.dlr.shepard.neo4Core.entities.TimeseriesReference;
5 import io.swagger.v3.oas.annotations.media.Schema;
6 import jakarta.validation.constraints.NotEmpty;
7 import jakarta.validation.constraints.NotNull;
8 import lombok.Data;
9 import lombok.EqualsAndHashCode;
10 import lombok.NoArgsConstructor;
11
12 @Data
13 @EqualsAndHashCode(callSuper = true)
14 @NoArgsConstructor
15 @Schema(name = "TimeseriesReference")
16 public class TimeseriesReferenceIO extends BasicReferenceIO {
17
18 @NotNull
19 private long start;
20
21 @NotNull
22 private long end;
23
24 @NotEmpty
25 private Timeseries[] timeseries;
26
27 @NotNull
28 private long timeseriesContainerId;
29
30 public TimeseriesReferenceIO(TimeseriesReference ref) {
31 super(ref);
32 this.start = ref.getStart();
33 this.end = ref.getEnd();
34 this.timeseries = ref.getTimeseries().toArray(Timeseries[]::new);
35 this.timeseriesContainerId = ref.getTimeseriesContainer() != null ? ref.getTimeseriesContainer().getId() : -1;
36 }
37
38 }