package seedu.ezdo.model.todo;

import seedu.ezdo.model.tag.UniqueTagList;

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

    Name getName();
    Priority getPriority();
    TaskDate getStartDate();
    TaskDate getDueDate();
    boolean getDone();

    /**
     * The returned TagList is a deep copy of the internal TagList,
     * changes on the returned list will not affect the task'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
                && other.getPriority().equals(this.getPriority())
                && other.getStartDate().equals(this.getStartDate()))
                && other.getDueDate().equals(this.getDueDate());
    }

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

}

@@ -1360,16 +1360,33 @@
 .append(
+%22Task: %22).append(
 getName(
@@ -1383,24 +1383,25 @@
 d(getName())
+;
 %0A           
@@ -1393,32 +1393,90 @@
 ));%0A        
-        
+if (!getPriority().toString().isEmpty()) %7B%0A                builder
 .append(%22 Pr
@@ -1516,32 +1516,33 @@
 d(getPriority())
+;
 %0A               
@@ -1530,32 +1530,34 @@
 ));%0A        
+%7D%0A
         
 .append(%22 St
@@ -1536,32 +1536,99 @@
       %7D%0A        
+if (!getStartDate().toString().isEmpty()) %7B%0A                builder
 .append(%22 StartD
@@ -1670,24 +1670,25 @@
 StartDate())
+;
 %0A           
@@ -1680,32 +1680,34 @@
 ));%0A        
+%7D%0A
         
 .append(%22 Du
@@ -1686,32 +1686,97 @@
       %7D%0A        
+if (!getDueDate().toString().isEmpty()) %7B%0A                builder
 .append(%22 DueDat
@@ -1818,16 +1818,17 @@
 eDate())
+;
 %0A       
@@ -1824,32 +1824,34 @@
 ));%0A        
+%7D%0A
         
 .append(%22 Ta
@@ -1830,32 +1830,91 @@
       %7D%0A        
+if (!getTags().toSet().isEmpty()) %7B%0A                builder
 .append(%22 Tags: 
@@ -1961,16 +1961,26 @@
 ppend);%0A
+        %7D%0A
         

Update ReadOnlyTask so when feedback command result won't print out empty fields