package gc.mda.kcg.domain.sensor;

import lombok.Builder;
import lombok.Getter;

public class SensorDto {

    @Getter
    @Builder
    public static class SeismicDto {
        private String usgsId;
        private double magnitude;
        private Double depth;
        private double lat;
        private double lng;
        private String place;
        private long timestamp; // epoch ms

        public static SeismicDto from(SeismicEvent e) {
            return SeismicDto.builder()
                    .usgsId(e.getUsgsId())
                    .magnitude(e.getMagnitude())
                    .depth(e.getDepth())
                    .lat(e.getLat())
                    .lng(e.getLng())
                    .place(e.getPlace())
                    .timestamp(e.getEventTime().toEpochMilli())
                    .build();
        }
    }

    @Getter
    @Builder
    public static class PressureDto {
        private String station;
        private double lat;
        private double lng;
        private double pressureHpa;
        private long timestamp; // epoch ms

        public static PressureDto from(PressureReading r) {
            return PressureDto.builder()
                    .station(r.getStation())
                    .lat(r.getLat())
                    .lng(r.getLng())
                    .pressureHpa(r.getPressureHpa())
                    .timestamp(r.getReadingTime().toEpochMilli())
                    .build();
        }
    }
}
