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.person.Address;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;
import seedu.address.model.person.UniquePersonList;
import seedu.address.model.tag.Tag;
import seedu.address.model.tag.UniqueTagList;

/**
 * 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 person to the address book. "
            + "Parameters: NAME p/PHONE e/EMAIL a/ADDRESS  [t/TAG]...\n"
            + "Example: " + COMMAND_WORD
            + " John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney";

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

    private final Person toAdd;

    /**
     * Creates an AddCommand using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public AddCommand(String name, String phone, String email, String address, Set<String> tags)
            throws IllegalValueException {
        final Set<Tag> tagSet = new HashSet<>();
        for (String tagName : tags) {
            tagSet.add(new Tag(tagName));
        }
        this.toAdd = new Person(
                new Name(name),
                new Phone(phone),
                new Email(email),
                new Address(address),
                new UniqueTagList(tagSet)
        );
    }

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

    }

}

@@ -561,38 +561,36 @@
 *%0A * Adds a 
-person
+todo
  to the 
 address book
@@ -577,28 +577,25 @@
  to the 
-address book
+todo list
 .%0A */%0Apu
@@ -765,22 +765,20 @@
 s a 
-person
+todo
  to the 
 addr
@@ -773,28 +773,25 @@
  to the 
-address book
+todo list
 . %22%0A    
@@ -817,47 +817,125 @@
 rs: 
-NAME p/PHONE e/EMAIL a/ADDRESS 
+TODO %5Bt/TAG%5D %5Cn%22%0A            + %22OR: TODO d/DEADLINE %5Bt/TAG%5D %5Cn%22%0A            + %22OR: TODO s/STARTTIME e/ENDTIME
  %5Bt/TAG%5D
 ...%5C
@@ -934,11 +934,9 @@
 TAG%5D
-...
+ 
 %5Cn%22%0A
@@ -996,97 +996,72 @@
 + %22 
-John Doe p/98765432 e/johnd@gmail.com a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney
+Take dog for walk s/11-11-17/5:00pm e/11-11-17/6:00pm t/personal
 %22;%0A%0A
@@ -1114,22 +1114,20 @@
  = %22New 
-person
+todo
  added: 
@@ -1197,22 +1197,20 @@
 = %22This 
-person
+todo
  already
@@ -1228,20 +1228,17 @@
 the 
-address book
+todo list
 %22;%0A%0A
@@ -1255,22 +1255,20 @@
 e final 
-Person
+ToDo
  toAdd;%0A
@@ -1445,40 +1445,30 @@
 ing 
-name, String phone, String email
+todo, String starttime
 , St
@@ -1472,23 +1472,23 @@
  String 
-address
+endtime
 , Set%3CSt
@@ -1706,22 +1706,20 @@
 d = new 
-Person
+ToDo
 (%0A      
@@ -1741,18 +1741,16 @@
 ame(name
-),
 %0A       
@@ -1766,53 +1766,27 @@
 new 
-Phone(phone),%0A                new Email(email
+StartTime(starttime
 ),%0A 
@@ -1808,23 +1808,23 @@
 new 
-Address(address
+EndTime(endtime
 ),%0A 
@@ -2022,22 +2022,20 @@
 odel.add
-Person
+ToDo
 (toAdd);
@@ -2131,30 +2131,28 @@
 atch (Unique
-Person
+ToDo
 List.Duplica
@@ -2153,22 +2153,20 @@
 uplicate
-Person
+ToDo
 Exceptio
@@ -2229,22 +2229,20 @@
 PLICATE_
-PERSON
+TODO
 );%0A     

Add logic for add command