package com.lingniu.ingest.vehiclestat.jt808;

import java.time.Instant;

public record Jt808LocationPoint(
        String vehicleKey,
        String vin,
        String phone,
        Instant eventTime,
        double longitude,
        double latitude,
        Double speedKmh,
        Long statusFlag,
        Double totalMileageKm
) {

    public Jt808LocationPoint {
        if (vehicleKey == null || vehicleKey.isBlank()) {
            throw new IllegalArgumentException("vehicleKey must not be blank");
        }
        if (eventTime == null) {
            throw new IllegalArgumentException("eventTime must not be null");
        }
        vin = vin == null ? "" : vin;
        phone = phone == null ? "" : phone;
    }
}
