package seedu.address.logic.commands;

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

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

/**
 * Adds a person to the address book.
 */
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 address book.\n"
    		+ "Parameters: TASKNAME d/TASK_DESCRIPTION date/DD.MM.YY time/24HR [t/TAG]...\n"
            + "Example: " + COMMAND_WORD
            + " Wash Clothes d/Wash with detergent date/27.9.16 time/2359 t/!!!";

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

    private final Task toAdd;

    /**
     * Convenience constructor using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public AddCommand(String name, String phone, List<java.util.Date> dateList, 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 Name(name),
                new Description(phone),
                new Date(dateList),
                new Time(dateList),
                new UniqueTagList(tagSet)
        );
    }

    @Override
    public CommandResult execute() {
        assert model != null;
        try {
            model.addPerson(toAdd);
            return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
        } catch (UniquePersonList.DuplicatePersonException e) {
            return new CommandResult(MESSAGE_DUPLICATE_PERSON);
        }

    }

}

@@ -591,24 +591,33 @@
 e/DD
-.MM.YY time/
+-MM-YYYY %5B24HR%5D %5Bto 
 24HR
+%5D
  %5Bt/
@@ -730,19 +730,16 @@
 e/27
-.9.16 time/
+-9-2016 
 2359

edit AddCommand help messages