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 jakarta.validation.constraints.NotEmpty;
6 import jakarta.validation.constraints.NotNull;
7 import lombok.Data;
8 import lombok.EqualsAndHashCode;
9 import lombok.NoArgsConstructor;
10 import org.eclipse.microprofile.openapi.annotations.media.Schema;
11
12 @Data
13 @EqualsAndHashCode(callSuper = true)
14 @NoArgsConstructor
15 @Schema(name = "TimeseriesReference")
16 public class TimeseriesReferenceIO extends BasicReferenceIO {
17
18 @NotNull
19 @Schema(required = true)
20 private long start;
21
22 @NotNull
23 @Schema(required = true)
24 private long end;
25
26 @NotEmpty
27 @Schema(required = true)
28 private Timeseries[] timeseries;
29
30 @NotNull
31 @Schema(required = true)
32 private long timeseriesContainerId;
33
34 public TimeseriesReferenceIO(TimeseriesReference ref) {
35 super(ref);
36 this.start = ref.getStart();
37 this.end = ref.getEnd();
38 this.timeseries = ref.getTimeseries().toArray(Timeseries[]::new);
39 this.timeseriesContainerId = ref.getTimeseriesContainer() != null ? ref.getTimeseriesContainer().getId() : -1;
40 }
41 }