package at.procon.eventhub.tachographfilesession.dto;

import java.time.OffsetDateTime;

public record TachographOperatingPeriodsProcessingRequest(
        OffsetDateTime occurredFrom,
        OffsetDateTime occurredTo,
        Integer operatingSplitIdleHours,
        Integer significantDrivingMinutes,
        Integer mergeGapSeconds,
        Integer gapDetectionToleranceSeconds
) {
    public TachographOperatingPeriodsProcessingRequest {
        operatingSplitIdleHours = operatingSplitIdleHours == null ? null : Math.max(1, operatingSplitIdleHours);
        significantDrivingMinutes = significantDrivingMinutes == null ? null : Math.max(1, significantDrivingMinutes);
        mergeGapSeconds = mergeGapSeconds == null ? null : Math.max(0, mergeGapSeconds);
        gapDetectionToleranceSeconds = gapDetectionToleranceSeconds == null ? null : Math.max(0, gapDetectionToleranceSeconds);
    }
}
