@name('drivingInterruptionVehicleChangeIntervals')
select
    sessionId,
    driverKey,
    startedAt,
    endedAt,
    durationSeconds,
    previousDrivingSourceIntervalId,
    nextDrivingSourceIntervalId,
    previousRegistrationKey,
    nextRegistrationKey,
    previousVehicleKey,
    nextVehicleKey
from TachographDrivingInterruptionIntervalInputEvent(
    previousRegistrationKey is not null,
    nextRegistrationKey is not null,
    previousRegistrationKey != nextRegistrationKey
);
