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

/**
 * Adds a person to the address book.
 */
public class CreateCommand extends Command {

    public static final String COMMAND_WORD = "create";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Creates a task to uTask. "
            + "Parameters: NAME  [/by DEADLINE] [/from START_TIME to END_TIME] [/repeat FREQUENCY] [/tag TAG]...\n"
            + "Example: " + COMMAND_WORD
            + " read essay /by 200217 /from /tag urgent /tag assignment";

    public static final String MESSAGE_SUCCESS = "New task created: %1$s";
    public static final String MESSAGE_DUPLICATE_PERSON = "This task already exists in uTask";

    private final Person toAdd;

    /**
     * Creates an AddCommand using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public CreateCommand(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);
        }

    }

}

@@ -538,40 +538,34 @@
 %0A * 
-Adds a person to the address boo
+Creates a new task to uTas
 k.%0A 
@@ -1224,19 +1224,22 @@
 ates an 
-Add
+Create
 Command 
@@ -1390,19 +1390,22 @@
  String 
-pho
+deadli
 ne, Stri
@@ -1411,29 +1411,35 @@
 ing 
-email, String address
+timestamp, String frequency
 , Se
@@ -1731,11 +1731,14 @@
 one(
-pho
+deadli
 ne),
@@ -1768,13 +1768,17 @@
 ail(
-email
+timestamp
 ),%0A 
@@ -1804,23 +1804,25 @@
 Address(
-address
+frequency
 ),%0A     

Update CreateCommand parameters