package seedu.taskboss.logic.commands;

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

import seedu.taskboss.commons.exceptions.IllegalValueException;
import seedu.taskboss.logic.commands.exceptions.CommandException;
import seedu.taskboss.model.category.Category;
import seedu.taskboss.model.category.UniqueCategoryList;
import seedu.taskboss.model.task.DateTime;
import seedu.taskboss.model.task.Information;
import seedu.taskboss.model.task.Name;
import seedu.taskboss.model.task.PriorityLevel;
import seedu.taskboss.model.task.Task;
import seedu.taskboss.model.task.UniqueTaskList;

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

    public static final String COMMAND_WORD = "add";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a task to TaskBoss. "
            + "Parameters: NAME p/PRIORITY_LEVEL sd/START_DATE ed/END_DATE "
            + "i/INFORMATION [c/CATEGORY]...\n"
            + "Example: " + COMMAND_WORD
            + " Submit report p/3 sd/today 5pm ed/next friday 11.59pm i/inform partner c/Work c/Project";

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

    private final Task toAdd;

    /**
     * Creates an AddCommand using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public AddCommand(String name, String priorityLevel, String startDateTime, String endDateTime,
            String information, Set<String> categories) throws IllegalValueException {
        final Set<Category> categorySet = new HashSet<>();
        for (String categoryName : categories) {
            categorySet.add(new Category(categoryName));
        }
        this.toAdd = new Task(
                new Name(name),
                new PriorityLevel(priorityLevel),
                new DateTime(startDateTime),
                new DateTime(endDateTime),
                new Information(information),
                new UniqueCategoryList(categorySet)
        );
    }

    @Override
    public CommandResult execute() throws CommandException {
        assert model != null;
        try {
            model.addTask(toAdd);
            return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
        } catch (UniqueTaskList.DuplicateTaskException e) {
            throw new CommandException(MESSAGE_DUPLICATE_TASK);
        }

    }

}

@@ -842,16 +842,17 @@
 s: NAME 
+%5B
 p/PRIORI
@@ -859,17 +859,19 @@
 TY_LEVEL
- 
+%5D %5B
 sd/START
@@ -875,17 +875,19 @@
 ART_DATE
- 
+%5D %5B
 ed/END_D
@@ -889,16 +889,17 @@
 END_DATE
+%5D
  %22%0A     
@@ -908,16 +908,17 @@
      + %22
+%5B
 i/INFORM
@@ -922,16 +922,17 @@
 ORMATION
+%5D
  %5Bc/CATE
@@ -984,16 +984,16 @@
 ND_WORD%0A
-
         
@@ -1000,16 +1000,18 @@
     + %22 
+n/
 Submit r

Update add command example