package gc.mda.signal_batch.domain.vessel.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * AIS 수집 데이터 모델
 * S&P Global AIS API → Caffeine 캐시 → 배치 집계에서 사용
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class VesselData {
    private String mmsi;
    private LocalDateTime messageTime;
    private Double lat;
    private Double lon;
    private BigDecimal sog;
    private BigDecimal cog;
    private Integer heading;
    private String shipNm;
    private String shipTy;
    private Integer rot;

    public String getVesselKey() {
        return mmsi;
    }

    public boolean isValidPosition() {
        return lat != null && lon != null &&
                lat >= -90 && lat <= 90 &&
                lon >= -180 && lon <= 180;
    }
}
