package uk.ac.ebi.quickgo.rest.period;

import com.google.common.base.Preconditions;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Objects;
import javax.validation.constraints.NotNull;

/**
 * An implementation of a {@link Period} which uses two values for {@link DayTime} as start and end points to
 * determine remaining time.
 *
 * @author Tony Wardell
 * Date: 11/04/2017
 * Time: 12:46
 * Created with IntelliJ IDEA.
 */
public class ReducingDailyPeriod implements Period {

    @NotNull
    private final DayTime start;
    @NotNull
    private final DayTime end;

    ReducingDailyPeriod(DayTime start, DayTime end) {
        Preconditions.checkArgument(Objects.nonNull(start), "The ReducingDailyPeriod constructor start parameter " +
                "must not be null.");
        Preconditions.checkArgument(Objects.nonNull(end),"The ReducingDailyPeriod constructor end parameter " +
                "must not be null.");
        this.start = start;
        this.end = end;
    }

    public Duration remainingTime(LocalDateTime target) {
        LocalDateTime startDateTime = start.toInstant(target);
        LocalDateTime endDateTime = end.toInstant(target);
        Duration remaining;
        if (target.isAfter(startDateTime) && target.isBefore(endDateTime)){
            remaining = Duration.between(target, endDateTime);
        }else{
            remaining = Duration.ZERO;
        }
        return remaining;
    }
}

@@ -536,21 +536,27 @@
 final Da
-yTime
+teModifying
  start;%0A
@@ -588,21 +588,27 @@
 final Da
-yTime
+teModifying
  end;%0A%0A 
@@ -636,28 +636,40 @@
 d(Da
-yTime start, DayTime
+teModifying start, DateModifying
  end

Change constructor parameter types from DayTime to DateModifying - as this interface defines the only method we need to call.