package de.ph87.homeautomation.schedule.astro; import lombok.Getter; import lombok.ToString; import org.springframework.lang.NonNull; import org.springframework.lang.Nullable; import java.time.ZonedDateTime; @Getter @ToString public class AstroDto { @NonNull private final double zenith; @NonNull private final ZonedDateTime sunrise; @NonNull private final ZonedDateTime sunset; @NonNull private final String sunriseName; @Nullable private final String sunsetName; public AstroDto(@NonNull final Astro astro, @NonNull final ZonedDateTime sunrise, @NonNull final ZonedDateTime sunset) { this.zenith = astro.getZenith(); this.sunrise = sunrise; this.sunset = sunset; this.sunriseName = astro.getName(); this.sunsetName = astro.getDifferentNameForSunset() == null ? astro.getName() : astro.getDifferentNameForSunset(); } }