package savvytodo.model.task;

import savvytodo.model.category.UniqueCategoryList;

/**
 * @author A0140016B (Contributer)
 * A read-only immutable interface for a Task in the taskManager.
 * Implementations should guarantee: details are present and not null, field values are validated.
 */
public interface ReadOnlyTask {

    Name getName();

    Priority getPriority();

    Description getDescription();

    Location getLocation();

    DateTime getDateTime();

    Recurrence getRecurrence();

    Status isCompleted();

    Type getType();

    TimeStamp getTimeStamp();

    /**
     * The returned CategoryList is a deep copy of the internal CategoryList,
     * changes on the returned list will not affect the task's internal categories.
     */
    UniqueCategoryList getCategories();

    /**
     * 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.isCompleted().equals(this.isCompleted())
                        && other.getDescription().equals(this.getDescription())
                        && other.getDateTime().equals(this.getDateTime())
                        && other.getLocation().equals(this.getLocation()))
                        && other.isCompleted().equals(this.isCompleted())
                        && other.getType().equals(this.getType());
    }

    /**
     * Formats the task as text, showing all contact details.
     */
    default String getAsText() {
        final StringBuilder builder = new StringBuilder();
        builder.append(getName()).append(" Date Time: ").append(getDateTime())
                .append(" Recurrence: ").append(getRecurrence()).append(" Priority: ")
                .append(getPriority()).append(" Location: ").append(getLocation())
                .append(" Description: ").append(getDescription()).append(" Status: ")
                .append(isCompleted()).append(" Categories: ");
        getCategories().forEach(builder::append);
        return builder.toString();
    }

}
@@ -334,25 +334,24 @@
  getName();%0A
-%0A
     Priority
@@ -362,25 +362,24 @@
 Priority();%0A
-%0A
     Descript
@@ -396,25 +396,24 @@
 cription();%0A
-%0A
     Location
@@ -424,25 +424,24 @@
 Location();%0A
-%0A
     DateTime
@@ -452,25 +452,24 @@
 DateTime();%0A
-%0A
     Recurren
@@ -484,25 +484,24 @@
 currence();%0A
-%0A
     Status i
@@ -510,25 +510,24 @@
 ompleted();%0A
-%0A
     Type get
@@ -530,25 +530,24 @@
  getType();%0A
-%0A
     TimeStam
@@ -1085,32 +1085,24 @@
             
-        
 && other.get
@@ -1172,32 +1172,24 @@
             
-      
-  
 && other.get
@@ -1222,32 +1222,24 @@
 Priority())%0A
-        
             
@@ -1304,32 +1304,24 @@
             
-    
-    
 && other.get
@@ -1376,32 +1376,24 @@
             
-        
 && other.get
@@ -1442,32 +1442,24 @@
             
-  
-      
 && other.get
@@ -1509,32 +1509,24 @@
             
-       
- 
 && other.isC
@@ -1559,32 +1559,24 @@
 ompleted())%0A
-        
             
@@ -1828,24 +1828,41 @@
 d(getName())
+%0A                
 .append(%22 Da
@@ -1868,24 +1868,41 @@
 ate Time: %22)
+%0A                
 .append(getD
@@ -1948,24 +1948,41 @@
 currence: %22)
+%0A                
 .append(getR
@@ -1993,16 +1993,33 @@
 rence())
+%0A                
 .append(
@@ -2071,16 +2071,33 @@
 ority())
+%0A                
 .append(
@@ -2102,32 +2102,49 @@
 d(%22 Location: %22)
+%0A                
 .append(getLocat
@@ -2191,16 +2191,33 @@
 tion: %22)
+%0A                
 .append(
@@ -2233,16 +2233,33 @@
 ption())
+%0A                
 .append(
@@ -2309,16 +2309,33 @@
 leted())
+%0A                
 .append(
@@ -2445,8 +2445,9 @@
     %7D%0A%0A%7D
+%0A

resolve merge