com.geotab.model.entity.worktime.WorkTimeAllHours Maven / Gradle / Ivy
package com.geotab.model.entity.worktime;
import com.geotab.model.enumeration.DayOfWeek;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@Getter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class WorkTimeAllHours extends WorkTimeSystem {
private static class InstanceHolder {
private static final WorkTimeAllHours INSTANCE = new WorkTimeAllHours();
}
public static final String WORK_TIME_ALL_HOURS_ID = "WorkTimeAllHoursId";
private WorkTimeAllHours() {
super(WORK_TIME_ALL_HOURS_ID, "**All Hours", null, getDefaultWorkTimeAllHoursDetail(), null);
}
private static List getDefaultWorkTimeAllHoursDetail() {
List workTimeDetails = new ArrayList<>(7);
DayOfWeek[] daysOfWeek = DayOfWeek.values();
for (int i = 0; i < 7; i++) {
workTimeDetails.add(new WorkTimeDetail(null,
daysOfWeek[i],
Duration.ofMillis(WorkTimeDetail.MIN_VALUE),
Duration.ofMillis(WorkTimeDetail.MAX_VALUE)
));
}
return workTimeDetails;
}
public static WorkTimeAllHours getInstance() {
return InstanceHolder.INSTANCE;
}
}