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

import at.procon.eventhub.processing.driverworkingtime.model.DriverWorkingTimeDerivedProjectionBundle;
import at.procon.eventhub.processing.driverworkingtime.model.DriverWorkingTimeProcessingInput;
import java.util.Objects;
import org.springframework.stereotype.Service;

@Service
public class DriverWorkingTimeDerivedProjectionEngine {

    private final DriverWorkingTimeReusableProjectionBuilder projectionBuilder;

    public DriverWorkingTimeDerivedProjectionEngine(
            DriverWorkingTimeReusableProjectionBuilder projectionBuilder
    ) {
        this.projectionBuilder = projectionBuilder;
    }

    public DriverWorkingTimeDerivedProjectionBundle build(DriverWorkingTimeProcessingInput input) {
        Objects.requireNonNull(input, "input must not be null");
        return projectionBuilder.buildDerivedProjectionBundle(input);
    }
}
