package seedu.geekeep.model.task;

import seedu.geekeep.model.tag.UniqueTagList;

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

    /**
     * Formats the Task as text, showing all contact details.
     */
    default String getAsText() {
        final StringBuilder builder = new StringBuilder();
        builder.append(getTitle()).append(" Ending DateTime: ").append(getEndDateTime())
               .append(" Starting DateTime: ").append(getStartDateTime())
               .append(" Description: ").append(getDescriptoin()).append(" Tags: ");
        getTags().forEach(builder::append);
        return builder.toString();
    }

    /**
     * Retrieve the DateTime representation of the ending date and time of the task
     * @return endingDateTime
     */
    DateTime getEndDateTime();

    /**
     * Retrieve the description of the task
     * @return Description of the Task
     */
    Description getDescriptoin();

    /**
     * Retrieve the DateTime representation of the starting date and time of the task
     * @return startingDateTime
     */
    DateTime getStartDateTime();

    /**
     * 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();

    /**
     * Retrieve the title of the task
     * @return Title
     */
    Title getTitle();

    /**
     * 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
                        && other.isEvent()
                        && this.isEvent() // this is first to avoid NPE below
                        && other.getTitle().equals(this.getTitle()) // state checks here onwards
                        && other.getStartDateTime().equals(this.getStartDateTime())
                        && other.getEndDateTime().equals(this.getEndDateTime())
                        && this.isDone() == other.isDone())
                || (other != null
                        && other.isDeadline()
                        && this.isDeadline()
                        && other.getTitle().equals(this.getTitle()) // state checks here onwards
                        && other.getEndDateTime().equals(this.getEndDateTime())
                        && this.isDone() == other.isDone())
                || (other != null
                        && other.isFloatingTask()
                        && this.isFloatingTask()
                        && other.getTitle().equals(this.getTitle()) // state checks here onwards
                        && this.isDone() == other.isDone());
    }

    //@@author A0148037E
    public int getPriority();

    DateTime getReferenceDateTime();

    public int comparePriority(ReadOnlyTask otherTask);

    int compareDate(ReadOnlyTask otherTask);

    public int comparePriorityAndDatetimeAndTitle(ReadOnlyTask otherTask);

    public int compareTitle(ReadOnlyTask otherTask);
    //@@author

    /**
     * Returns true if the task does not have a start datetime or end datetime
     * @return floating task identity
     */
    boolean isFloatingTask();

    /**
     * Returns true if the task has a start datetime nad an end datetime
     * @return event identity
     */
    boolean isEvent();

    /**
     * Returns true if the task has an end datetime but not a start datetime
     * @return deadline identity
     */
    boolean isDeadline();

    /**
     * Returns true if the task is marked as completed by user
     * @return status of the task
     */
    boolean isDone();
}

@@ -1833,36 +1833,32 @@
                 
-    
 && other.isEvent
@@ -1860,20 +1860,16 @@
 Event()%0A
-    
         
@@ -1946,36 +1946,32 @@
                 
-    
 && other.getTitl
@@ -2039,36 +2039,32 @@
                 
-   
- 
 && other.getStar
@@ -2119,36 +2119,32 @@
                 
-    
 && other.getEndD
@@ -2195,36 +2195,32 @@
                 
-   
- 
 && this.isDone()
@@ -2285,36 +2285,32 @@
                 
-    
 && other.isDeadl
@@ -2327,36 +2327,32 @@
                 
-  
-  
 && this.isDeadli
@@ -2348,36 +2348,32 @@
 is.isDeadline()%0A
-    
                 
@@ -2461,36 +2461,32 @@
                 
-  
-  
 && other.getEndD
@@ -2517,36 +2517,32 @@
 tEndDateTime())%0A
-    
                 
@@ -2627,36 +2627,32 @@
                 
- 
-   
 && other.isFloat
@@ -2673,36 +2673,32 @@
                 
-    
 && this.isFloati
@@ -2698,36 +2698,32 @@
 sFloatingTask()%0A
-    
                 
@@ -2791,36 +2791,32 @@
 ks here onwards%0A
-    
                 

fix indentation