package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DEADLINE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DESCRIPTION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ID;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import java.util.NoSuchElementException;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.IncorrectCommand;

/**
 * Parses input arguments and creates a new AddCommand object
 */
public class AddCommandParser {

    /**
     * Parses the given {@code String} of arguments in the context of the AddCommand
     * and returns an AddCommand object for execution.
     */
    public Command parse(String args) {
        ArgumentTokenizer argsTokenizer =
                new ArgumentTokenizer(PREFIX_DEADLINE, PREFIX_DESCRIPTION, PREFIX_ID, PREFIX_TAG);
        argsTokenizer.tokenize(args);
        try {
            return new AddCommand(
                    argsTokenizer.getPreamble().get(),
                    argsTokenizer.getValue(PREFIX_DEADLINE).get(),
                    argsTokenizer.getValue(PREFIX_DESCRIPTION).get(),
                    argsTokenizer.getValue(PREFIX_ID).get(),
                    ParserUtil.toSet(argsTokenizer.getAllValues(PREFIX_TAG))
            );
        } catch (NoSuchElementException nsee) {
            return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE));
        } catch (IllegalValueException ive) {
            return new IncorrectCommand(ive.getMessage());
        }
    }

}

@@ -255,70 +255,8 @@
 ON;%0A
-import static seedu.address.logic.parser.CliSyntax.PREFIX_ID;%0A
 impo
@@ -987,19 +987,8 @@
 ION,
- PREFIX_ID,
  PRE
@@ -997,16 +997,16 @@
 X_TAG);%0A
+
         
@@ -1199,20 +1199,128 @@
 ADLINE).
-get(
+orElse(null),%0A                    //ParserUtil.parseDescription(argsTokenizer.getValue(PREFIX_DESCRIPTION).get()
 ),%0A     
@@ -1343,32 +1343,40 @@
 rgsTokenizer.get
+Optional
 Value(PREFIX_DES
@@ -1385,20 +1385,25 @@
 IPTION).
-get(
+orElse(%22%22
 ),%0A     
@@ -1409,32 +1409,34 @@
                 
+//
 argsTokenizer.ge

remove ID from AddCommand parser