package seedu.tache.model.task;

import seedu.tache.model.tag.UniqueTagList;

public class DetailedTask extends Task implements ReadOnlyDetailedTask {

    private Date startDate;
    private Date endDate;
    private Time startTime;
    private Time endTime;

    public DetailedTask(Name name, UniqueTagList tags) {
        super(name, tags);
    }

    public DetailedTask(Name name, Date startDate, Date endDate, Time startTime, Time endTime, UniqueTagList tags) {
        super(name, tags);
        this.startDate = startDate;
        this.endDate = endDate;
        this.startTime = startTime;
        this.endTime = endTime;
    }

    /**
     * Creates a copy of the given ReadOnlyDetailedTask.
     */
    public DetailedTask(ReadOnlyDetailedTask source) {
        this(source.getName(), source.getStartDate(), source.getEndDate(), source.getStartTime(), source.getEndTime(),
             source.getTags());
    }

    @Override
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    @Override
    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    @Override
    public Time getStartTime() {
        return startTime;
    }

    public void setStartTime(Time startTime) {
        this.startTime = startTime;
    }

    @Override
    public Time getEndTime() {
        return endTime;
    }

    public void setEndTime(Time endTime) {
        this.endTime = endTime;
    }

    /**
     * Updates this detailed task with the details of {@code replacement}.
     */
    public void resetData(ReadOnlyDetailedTask replacement) {
        assert replacement != null;
        this.setName(replacement.getName());
        this.setEndDate(replacement.getEndDate());
        this.setStartDate(replacement.getStartDate());
        this.setStartTime(replacement.getStartTime());
        this.setEndTime(replacement.getEndTime());
        this.setTags(replacement.getTags());
    }

    @Override
    public boolean isSameStateAs(ReadOnlyTask other) {
        // TODO Auto-generated method stub
        return ReadOnlyDetailedTask.super.isSameStateAs(other);
    }

    @Override
    public String getAsText() {
        // TODO Auto-generated method stub
        return ReadOnlyDetailedTask.super.getAsText();
    }

}

@@ -26,16 +26,44 @@
 .task;%0A%0A
+import java.util.Optional;%0A%0A
 import s
@@ -98,16 +98,16 @@
 agList;%0A
-
 %0Apublic 
@@ -213,20 +213,30 @@
 private 
+Optional%3C
 Date
+%3E
  endDate
@@ -249,20 +249,30 @@
 private 
+Optional%3C
 Time
+%3E
  startTi
@@ -287,20 +287,30 @@
 private 
+Optional%3C
 Time
+%3E
  endTime
@@ -602,31 +602,52 @@
 s.endDate = 
+Optional.ofNullable(
 endDate
+)
 ;%0A        th
@@ -653,32 +653,52 @@
 his.startTime = 
+Optional.ofNullable(
 startTime;%0A     
@@ -686,24 +686,25 @@
 le(startTime
+)
 ;%0A        th
@@ -708,39 +708,60 @@
  this.endTime = 
+Optional.ofNullable(
 endTime
+)
 ;%0A    %7D%0A%0A    /**
@@ -1268,32 +1268,55 @@
   return endDate
+.orElse(getStartDate())
 ;%0A    %7D%0A%0A    pub
@@ -1374,23 +1374,44 @@
 dDate = 
+Optional.ofNullable(
 endDate
+)
 ;%0A    %7D%0A
@@ -1474,32 +1474,57 @@
 return startTime
+.orElse(new Time(%220000%22))
 ;%0A    %7D%0A%0A    pub
@@ -1584,24 +1584,44 @@
 startTime = 
+Optional.ofNullable(
 startTime;%0A 
@@ -1613,24 +1613,25 @@
 le(startTime
+)
 ;%0A    %7D%0A%0A   
@@ -1686,32 +1686,55 @@
   return endTime
+.orElse(getStartTime())
 ;%0A    %7D%0A%0A    pub
@@ -1792,23 +1792,44 @@
 dTime = 
+Optional.ofNullable(
 endTime
+)
 ;%0A    %7D%0A

Update DetailedTask startTime, endDate and endTime to be Optional