package seedu.address.logic.commands;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.model.tag.Tag;
import seedu.address.model.tag.UniqueTagList;
import seedu.address.model.task.*;

import java.util.HashSet;
import java.util.Set;

/**
 * Adds a task to the Lifekeeper.
 */
public class AddCommand extends Command {

    public static final String COMMAND_WORD = "add";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a task to the Lifekeeper. "
            + "Parameters: NAME d/DUEDATE p/PRIORITY r/REMINDER  [t/TAG]...\n"
            + "Example: " + COMMAND_WORD
            + " CS2103 T7A1 d/06-10-2016 p/1 r/05-01-2016 t/CS t/groupwork";

    public static final String MESSAGE_SUCCESS = "New task added: %1$s";
    public static final String MESSAGE_DUPLICATE_TASK = "This task already exists in the Lifekeeper";

    private final Task toAdd;

    /**
     * Convenience constructor using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public AddCommand(String name, String duedate, String priority, String reminder, Set<String> tags)
            throws IllegalValueException {
        final Set<Tag> tagSet = new HashSet<>();
        for (String tagName : tags) {
            tagSet.add(new Tag(tagName));
        }
        this.toAdd = new Task(
                new TaskName(name),
                new DueDate(duedate),
                new Priority(priority),
                new Reminder(reminder),
                new UniqueTagList(tagSet)
        );
    }

    @Override
    public CommandResult execute() {
        assert model != null;
        try {
            model.addTask(toAdd);
            
            PreviousCommand addCommand = new PreviousCommand(COMMAND_WORD,toAdd);
            PreviousCommandsStack.push(addCommand);
            
            return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
        } catch (UniqueTaskList.DuplicateTaskException e) {
            return new CommandResult(MESSAGE_DUPLICATE_TASK);
        }

    }

}

@@ -531,16 +531,17 @@
 s: NAME 
+%5B
 d/DUEDAT
@@ -541,17 +541,19 @@
 /DUEDATE
- 
+%5D %5B
 p/PRIORI
@@ -554,17 +554,19 @@
 PRIORITY
- 
+%5D %5B
 r/REMIND
@@ -567,17 +567,17 @@
 REMINDER
- 
+%5D
  %5Bt/TAG%5D
@@ -623,28 +623,68 @@
 AND_WORD
-%0A           
+ + %22 Online Assignment%5Cn%22%0A            + COMMAND_WORD
  + %22 CS2

Update Add command example for floating task