/**
 * Copyright (C) 2013 Motown.IO (info@motown.io)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.motown.domain.api.chargingstation;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Denotes the opening times of a charging station.
 * The opening times exist of a day (where monday is the first day of the week), a starting time and an ending time.
 */
public final class OpeningTime {
    private final Day day;
    private final TimeOfDay timeStart;
    private final TimeOfDay timeStop;

    /**
     * Construct a new {@code OpeningTime} object using a day, timeStart and timeStop
     *
     * @param day the day of the week (where 1 is monday).
     * @param timeStart the time when the charging station is first open.
     * @param timeStop the time when the charging station closes.
     * @throws java.lang.NullPointerException when one of the parameters is {@code null}.
     */
    public OpeningTime(Day day, TimeOfDay timeStart, TimeOfDay timeStop) {
        this.day = checkNotNull(day);
        this.timeStart = checkNotNull(timeStart);
        this.timeStop = checkNotNull(timeStop);
    }

    public Day getDay() {
        return day;
    }

    public TimeOfDay getTimeStart() {
        return timeStart;
    }

    public TimeOfDay getTimeStop() {
        return timeStop;
    }
}

@@ -659,16 +659,82 @@
 ation;%0A%0A
+import static com.google.common.base.Preconditions.checkArgument;%0A
 import s
@@ -1500,16 +1500,125 @@
 l%7D.%0A
+     * @throws java.lang.IllegalArgumentException when %7B@code timeStop%7D is not later than %7B@code timeStart%7D.%0A
      */%0A
     
@@ -1613,16 +1613,16 @@
      */%0A
-
     publ
@@ -1738,95 +1738,323 @@
     
-this.timeStart = checkNotNull(timeStart);%0A        this.timeStop = checkNotNull(
+checkNotNull(timeStart);%0A        checkNotNull(timeStop);%0A        checkArgument(timeStart.getHourOfDay() == timeStop.getHourOfDay() ? timeStop.getMinutesInHour() %3E timeStart.getMinutesInHour() : timeStop.getHourOfDay() %3E timeStart.getHourOfDay());%0A        this.timeStart = timeStart;%0A        this.timeStop = 
 timeStop
 );%0A 
@@ -2045,25 +2045,24 @@
 p = timeStop
-)
 ;%0A    %7D%0A%0A   

check that timeStop is later than timeStart for openingTimes