package at.procon.eventhub.processing.model;

import java.util.Objects;
import java.util.UUID;

public record UnifiedDriverTimelineRequest(
        UnifiedEventSourceFamily sourceFamily,
        UUID sessionId,
        String driverKey
) {
    public UnifiedDriverTimelineRequest {
        Objects.requireNonNull(sourceFamily, "sourceFamily must not be null");
        Objects.requireNonNull(sessionId, "sessionId must not be null");
        if (driverKey == null || driverKey.isBlank()) {
            throw new IllegalArgumentException("driverKey must not be blank");
        }
        driverKey = driverKey.trim();
    }

    public static UnifiedDriverTimelineRequest forTachographFileSession(
            UUID sessionId,
            String driverKey
    ) {
        return new UnifiedDriverTimelineRequest(
                UnifiedEventSourceFamily.TACHOGRAPH_FILE_SESSION,
                sessionId,
                driverKey
        );
    }
}
