package seedu.address.logic.commands;

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

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.todo.Name;
import seedu.address.model.todo.ToDo;
import seedu.address.model.todo.StartTime;
import seedu.address.model.todo.EndTime;
import seedu.address.model.todo.UniqueToDoList;
import seedu.address.model.tag.Tag;
import seedu.address.model.tag.UniqueTagList;

/**
 * Adds a todo to the todo list.
 */
public class AddCommand extends Command {

    public static final String COMMAND_WORD = "add";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a todo to the todo list. "
            + "Parameters: TODO [t/TAG] \n"
            + "OR: TODO d/DEADLINE [t/TAG] \n"
            + "OR: TODO s/STARTTIME e/ENDTIME [t/TAG] \n"
            + "Example: " + COMMAND_WORD
            + " Take dog for walk s/11-11-17/5:00pm e/11-11-17/6:00pm t/personal";

    public static final String MESSAGE_SUCCESS = "New todo added: %1$s";
    public static final String MESSAGE_DUPLICATE_PERSON = "This todo already exists in the todo list";

    private final ToDo toAdd;

    /**
     * Creates an AddCommand using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public AddCommand(String todo, String starttime, String endtime, Set<String> tags)
            throws IllegalValueException {
        final Set<Tag> tagSet = new HashSet<>();
        for (String tagName : tags) {
            tagSet.add(new Tag(tagName));
        }
        this.toAdd = new ToDo(
                new Name(name
                new Time(starttime),
                new Time(endtime),
                new UniqueTagList(tagSet)
        );
    }

    @Override
    public CommandResult execute() throws CommandException {
        assert model != null;
        try {
            model.addToDo(toAdd);
            return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
        } catch (UniqueToDoList.DuplicateToDoException e) {
            throw new CommandException(MESSAGE_DUPLICATE_TODO);
        }

    }

}

@@ -241,16 +241,14 @@
 el.t
-odo.Name
+ag.Tag
 ;%0Aim
@@ -277,59 +277,24 @@
 el.t
-odo.ToDo;%0Aimport seedu.address.model.todo.StartTime
+ag.UniqueTagList
 ;%0Aim
@@ -327,13 +327,10 @@
 odo.
-EndTi
+Na
 me;%0A
@@ -361,30 +361,20 @@
 el.todo.
-UniqueToDoList
+Todo
 ;%0Aimport
@@ -399,54 +399,19 @@
 el.t
-ag.Tag;%0Aimport seedu.address.model.tag
+odo
 .UniqueT
 agLi
@@ -410,17 +410,19 @@
 queT
-ag
+odo
 List;%0A%0A
+%0A
 /**%0A
@@ -1052,14 +1052,12 @@
 ATE_
-PERSON
+TODO
  = %22
@@ -1121,17 +1121,17 @@
 final To
-D
+d
 o toAdd;
@@ -1187,16 +1187,57 @@
 values.%0A
+     * * Only adds floating task for now%0A
      *%0A 
@@ -1355,42 +1355,8 @@
 odo,
- String starttime, String endtime,
  Set
@@ -1579,17 +1579,17 @@
 = new To
-D
+d
 o(%0A     
@@ -1612,82 +1612,12 @@
 ame(
-name%0A                new Time(starttime),%0A                new Time(endtime
+todo
 ),%0A 
@@ -1817,17 +1817,17 @@
 el.addTo
-D
+d
 o(toAdd)
@@ -1930,17 +1930,17 @@
 UniqueTo
-D
+d
 oList.Du
@@ -1948,17 +1948,17 @@
 licateTo
-D
+d
 oExcepti

Refactor add command