package seedu.address.model.task;

import java.util.Optional;

import seedu.address.model.tag.UniqueTagList;

/**
 * A read-only immutable interface for a Task in the task list.
 * Implementations should guarantee: details are present and not null, field values are validated.
 */
public interface ReadOnlyTask {

    Name getName();

    /**
     * TODO getDeadline()
     */
    Optional<Deadline> getDeadline();
    /**
     * Start and End Date time
     */
    Optional<StartEndDateTime> getStartEndDateTime();

    /**
     * The returned TagList is a deep copy of the internal TagList,
     * changes on the returned list will not affect the person's internal tags.
     */
    UniqueTagList getTags();

    /**
     * Returns true if both have the same state. (interfaces cannot override .equals)
     */
    default boolean isSameStateAs(ReadOnlyTask other) {
        return other == this // short circuit if same object
                || (other != null // this is first to avoid NPE below
                && other.getName().equals(this.getName())); // state checks here onwards
    }

    /**
     * Formats the person as text, showing all contact details.
     */
    default String getAsText() {
        final StringBuilder builder = new StringBuilder();
        builder.append(getName())
                .append(" Tags: ");
        getTags().forEach(builder::append);
        return builder.toString();
    }

}

@@ -56,16 +56,62 @@
 ional;%0A%0A
+import seedu.address.logic.parser.ParserUtil;%0A
 import s
@@ -361,66 +361,363 @@
     
-Name getName();%0A%0A    /**%0A     * TODO getDeadline()%0A     */
+/**%0A     * Gets the name of the task.%0A     */%0A    // TODO implementations must ensure this gets a deep copy or Name have no setter so it is not mutable.%0A    Name getName();%0A%0A    /**%0A     * Gets the %7B@link Optional%7D deadline of the task.%0A     */%0A    // TODO implementations must ensure this gets a deep copy or Deadline have no setter so it is not mutable.
 %0A   
@@ -747,24 +747,25 @@
 Deadline();%0A
+%0A
     /**%0A    
@@ -767,17 +767,43 @@
 %0A     * 
-S
+Gets the %7B@link Optional%7D s
 tart and
@@ -807,21 +807,21 @@
 and 
-End D
+end d
 ate time
 %0A   
@@ -816,24 +816,156 @@
 ate time
-%0A     */
+ of the task.%0A     */%0A    // TODO implementations must ensure this gets a deep copy or StartEndDateTime have no setter so it is not mutable.
 %0A    Opt
@@ -1144,22 +1144,20 @@
 ect the 
-person
+task
 's inter
@@ -1358,24 +1358,151 @@
 sk other) %7B%0A
+        // TODO check other fields as well%0A        // since this is error prone might want to consider Google's equals checker%0A
         retu
@@ -1747,14 +1747,12 @@
 the 
-person
+task
  as 
@@ -1773,22 +1773,13 @@
 all 
-contact detail
+field
 s.%0A 
@@ -1910,16 +1910,18 @@
 tName())
+;%0A
 %0A       
@@ -1921,24 +1921,904 @@
         
-        
+// TODO improve SLAP and consider lambda%0A        if (getDeadline().isPresent()) %7B%0A            builder.append(%22 Deadline: %22 + getDeadline().get().getValue().format(ParserUtil.DATE_TIME_FORMAT));%0A        %7D else %7B%0A            builder.append(%22 Deadline: none %22);%0A        %7D%0A%0A        // TODO improve SLAP and consider lambda%0A        if (getStartEndDateTime().isPresent()) %7B%0A            final StartEndDateTime startEndDateTime = getStartEndDateTime().get();%0A            builder.append(%22 Start Date: %22 + startEndDateTime.getStartDateTime().format(ParserUtil.DATE_TIME_FORMAT));%0A            builder.append(%22 End Date: %22 + startEndDateTime.getEndDateTime().format(ParserUtil.DATE_TIME_FORMAT));%0A        %7D else %7B%0A            builder.append(%22 Start Date: %22);%0A            builder.append(%22 End Date: %22);%0A        %7D%0A%0A        // TODO although only two lines, but SLAP can still be improved%0A        builder
 .append(
@@ -2873,16 +2873,17 @@
 ppend);%0A
+%0A
         

Update getAsText and comments in ReadOnlyTask