package seedu.jimi.logic.commands;

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

import seedu.jimi.commons.exceptions.IllegalValueException;
import seedu.jimi.model.tag.Tag;
import seedu.jimi.model.tag.UniqueTagList;
import seedu.jimi.model.task.*;

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

    public static final String COMMAND_WORD = "add";

    public static final String MESSAGE_USAGE = 
            COMMAND_WORD + ": Adds a task to Jimi with one optional tag.\n"
            + "Parameters: \"TASK_DETAILS\" [by DATE_TIME] [t/TAG]\n"
            + "Example: " + COMMAND_WORD
            + " \"do dishes\" t/important";

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

    private final ReadOnlyTask toAdd;

    /**
     * Convenience constructor using raw values.
     *
     * @throws IllegalValueException if any of the raw values are invalid
     */
    public AddCommand(String name, String dateTime, Set<String> tags) throws IllegalValueException {
        final Set<Tag> tagSet = new HashSet<>();
        for (String tagName : tags) {
            tagSet.add(new Tag(tagName));
        }
        
        this.toAdd = new FloatingTask(
                new Name(name),
                new UniqueTagList(tagSet)
        );
    }

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

    }

}

@@ -1259,25 +1259,50 @@
         
-%0A
+if (dateTime == null) %7B%0A  
         
 this.toA
@@ -1293,16 +1293,18 @@
         
+  
 this.toA
@@ -1312,73 +1312,209 @@
 d = 
-new FloatingTask(%0A                new Name(name),%0A               
+%0A                    new FloatingTask(new Name(name), new UniqueTagList(tagSet));%0A        %7D else %7B%0A            this.toAdd = %0A                    new DeadlineTask(new Name(name), new DateTime(dateTime),
  new
@@ -1535,16 +1535,18 @@
 (tagSet)
+);
 %0A       
@@ -1546,18 +1546,17 @@
         
-);
+%7D
 %0A    %7D%0A%0A

Modify AddCommand to differentiate floating tasks/deadline task