package at.procon.eventhub.processing.driverworkingtime.model;

import at.procon.eventhub.processing.eventprocessing.support.RuntimeSupportEvidenceEvent;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.UUID;

public record DriverWorkingTimeProcessingInput(
        UUID sessionId,
        String driverKey,
        String sourceKind,
        OffsetDateTime loadedFrom,
        OffsetDateTime loadedTo,
        OffsetDateTime requestedFrom,
        OffsetDateTime requestedTo,
        int significantDrivingMinutes,
        int minimumRestPeriodMinutes,
        List<DriverWorkingTimeActivityInterval> activityIntervals,
        List<DriverWorkingTimeVehicleUsageInterval> vehicleUsageIntervals,
        List<RuntimeSupportEvidenceEvent> supportEvidenceEvents,
        List<String> notes
) {
    public DriverWorkingTimeProcessingInput {
        significantDrivingMinutes = Math.max(1, significantDrivingMinutes);
        minimumRestPeriodMinutes = Math.max(1, minimumRestPeriodMinutes);
        activityIntervals = activityIntervals == null ? List.of() : List.copyOf(activityIntervals);
        vehicleUsageIntervals = vehicleUsageIntervals == null ? List.of() : List.copyOf(vehicleUsageIntervals);
        supportEvidenceEvents = supportEvidenceEvents == null ? List.of() : List.copyOf(supportEvidenceEvents);
        notes = notes == null ? List.of() : List.copyOf(notes);
    }
}
