package seedu.taskboss.logic.commands;

import java.util.EmptyStackException;

import seedu.taskboss.commons.exceptions.IllegalValueException;

//@@author A0138961W
/**
 * Undoes the most recent operation entered by user.
 */

public class UndoCommand extends Command {

    public static final String COMMAND_WORD = "undo";
    public static final String COMMAND_WORD_SHORT = "u";

    public static final String MESSAGE_USAGE = COMMAND_WORD + "/" + COMMAND_WORD_SHORT
            + ": Undoes the most recent operation entered by user\n"
            + "Example: " + COMMAND_WORD + " || " + COMMAND_WORD_SHORT;

    public static final String MESSAGE_SUCCESS = "The most recent operation has been undone!";

    public static final String MESSAGE_WITHOUT_PREVIOUS_OPERATION = "Cannot undo.";

    public UndoCommand() {}


    @Override
    public CommandResult execute() {
        assert model != null;
        try {
            model.undoTaskboss();
            model.updateFilteredListToShowAll();
            return new CommandResult(MESSAGE_SUCCESS);
        } catch (EmptyStackException ese) {
            return new CommandResult(MESSAGE_WITHOUT_PREVIOUS_OPERATION);
        } catch (IllegalValueException e) {
            return new CommandResult(e.getMessage());
        }
    }
}

@@ -696,17 +696,16 @@
 n undone
-!
 %22;%0A%0A    
@@ -910,16 +910,70 @@
   try %7B%0A
+            String input = model.undoTaskbossInput();%0A
         
@@ -1099,16 +1099,30 @@
 _SUCCESS
+ + %22:%22 + input
 );%0A     

Update UndoCommand.java