package seedu.taskell.model;

import seedu.taskell.model.task.Task;

/** Stores the relevant details of a command so it can be undone via UndoCommand
 * */
public class CommandHistory {
    private final String commandText, commandType;
    private final Task task;  //relevent task to be added, deleted or edited
    private boolean toRedo;
    
    public CommandHistory() {
        commandText = "default command text";
        commandType = "default command type";
        task = null;
    }
    
    public CommandHistory(String commandText, String commandType, Task task) {
        assert commandText != null;
        assert commandType != null;
        assert !commandText.trim().isEmpty();
        assert !commandType.trim().isEmpty();
        
        this.commandText = commandText;
        this.commandType = commandType;
        this.task = task;
    }
    
    public String getCommandText() {
        return commandText;
    }
    
    public String getCommandType() {
        return commandType;
    }
    
    public Task getTask() {
        return task;
    }
    
    public void setToRedoToTrue() {
        toRedo = true;
    }
}

@@ -23,16 +23,62 @@
 model;%0A%0A
+import com.google.common.eventbus.Subscribe;%0A%0A
 import s
@@ -107,16 +107,16 @@
 k.Task;%0A
-
 %0A/** Sto
@@ -288,22 +288,16 @@
 private 
-final 
 Task tas
@@ -820,24 +820,31 @@
  commandText
+.trim()
 ;%0A        th
@@ -867,24 +867,31 @@
  commandType
+.trim()
 ;%0A        th
@@ -1121,32 +1121,135 @@
 ask;%0A    %7D%0A    %0A
+    public void setTask(Task task) %7B%0A        assert task != null;%0A        this.task = task;%0A    %7D%0A    %0A
     public void 
@@ -1291,16 +1291,21 @@
 = true;%0A
-
     %7D%0A
+    %0A
 %7D%0A

add setTask() to commandHistory