package seedu.ezdo.model;

import java.util.ArrayList;
import java.util.EmptyStackException;

import seedu.ezdo.commons.core.UnmodifiableObservableList;
import seedu.ezdo.commons.exceptions.DateException;
import seedu.ezdo.commons.util.SearchParameters;
import seedu.ezdo.model.todo.ReadOnlyTask;
import seedu.ezdo.model.todo.Task;
import seedu.ezdo.model.todo.UniqueTaskList;
import seedu.ezdo.model.todo.UniqueTaskList.DuplicateTaskException;
import seedu.ezdo.model.todo.UniqueTaskList.SortCriteria;
import seedu.ezdo.model.todo.UniqueTaskList.TaskNotFoundException;

/**
 * The API of the Model component.
 */
public interface Model {
    /** Clears existing backing model and replaces with the provided new data. */
    void resetData(ReadOnlyEzDo newData);

    /** Returns the EzDo */
    ReadOnlyEzDo getEzDo();

    /** Returns the UserPrefs */
    UserPrefs getUserPrefs();

    void sortTasks(SortCriteria sortCriteria, Boolean isSortedAscending);
  //@@author A0139248X
    /** Deletes the given task. */
    void killTasks(ArrayList<ReadOnlyTask> tasksToKill) throws UniqueTaskList.TaskNotFoundException;

    /** Adds the given task. */
    void addTask(Task task) throws UniqueTaskList.DuplicateTaskException, DateException;

    /** Checks the task and makes sure the dates are logical.
     * i.e. start date not after due date.
     * @throws DateException
     */
    void checkTaskDate(ReadOnlyTask task) throws DateException;

    /** Toggles a task as done/undone.
     * @throws TaskNotFoundException */
    boolean toggleTasksDone(ArrayList<Task> tasksToToggle);

    /** Undo the previous undoable command
     * @throws EmptyStackException */
    void undo() throws EmptyStackException;

    /** Redo the previous undone command
     * @throws EmptyStackException */
    void redo() throws EmptyStackException;

    /** Update stack when new command is executed
     * @throws EmptyStackException */
    void updateStacks() throws EmptyStackException;
  //@@author A0139248X

    /**
     * Updates the task located at {@code filteredTaskListIndex} with {@code editedTask}.
     *
     * @throws DuplicateTaskException if updating the task's details causes the task to be equivalent to
     *      another existing task in the list.
     * @throws IndexOutOfBoundsException if {@code filteredTaskListIndex} < 0 or >= the size of the filtered list.
     */
    void updateTask(int filteredTaskListIndex, ReadOnlyTask editedTask)
            throws UniqueTaskList.DuplicateTaskException, DateException;

    /** Returns the filtered task list as an {@code UnmodifiableObservableList<ReadOnlyTask>} */
    UnmodifiableObservableList<ReadOnlyTask> getFilteredTaskList();

    /** Updates the filter of the filtered task list to show all tasks */
    void updateFilteredListToShowAll();

    /** Updates the filter of the filtered task list to filter by multiple fields*/
    void updateFilteredTaskList(SearchParameters searchParameters);

    /** Updates the filter of the filtered task list to show done tasks*/
    void updateFilteredDoneList();

}

@@ -997,33 +997,109 @@
 s the given task
-.
+s.%0A     * @throws TaskNotFoundException if any task is not found in ezDo%0A    
  */%0A    void kil
@@ -1205,23 +1205,196 @@
 dds 
-the given task.
+a task.%0A     * @throws DuplicateTaskException if the same task (all attributes and fields same) is already in ezDo%0A     * @throws DateException if the start date is after the due date%0A    
  */%0A
@@ -1556,12 +1556,36 @@
   * 
-i.e.
+@throws DateException if the
  sta
@@ -1596,18 +1596,21 @@
 ate 
-not
+is
  after 
+the 
 due 
@@ -1619,37 +1619,8 @@
 te.%0A
-     * @throws DateException%0A
     
@@ -1704,22 +1704,25 @@
 Toggles 
-a
+the
  task
+s
  as done
@@ -1733,45 +1733,8 @@
 one.
-%0A     * @throws TaskNotFoundException
  */%0A
@@ -1828,16 +1828,43 @@
 undoable
+ (add/edit/clear/kill/done)
  command
@@ -1891,32 +1891,64 @@
 yStackException 
+if there are no commands to undo
 */%0A    void undo
@@ -2047,32 +2047,72 @@
 yStackException 
+if there were no undone commands to redo
 */%0A    void redo
@@ -2163,16 +2163,17 @@
 te stack
+s
  when ne
@@ -2197,97 +2197,34 @@
 uted
-%0A     * @throws EmptyStackException */%0A    void updateStacks() throws EmptyStackException
+*/%0A    void updateStacks()
 ;%0A  

Update comments