package seedu.taskboss.logic.commands;

import java.util.Set;


/**
 * Finds and lists all tasks in TaskBoss whose name contains any of the argument keywords.
 * Keyword matching is case sensitive.
 */
public class FindCommand extends Command {

    public static final String COMMAND_WORD = "find";
    public static final String PREFIX_NAME = "/n";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all tasks whose names contain any of "
            + "the specified keywords (case-sensitive) and displays them as a list with index numbers.\n"
            + "Parameters: n/NAME or sd/STARTDATETIME or ed/ENDDATETIME \n"
            + "Example: " + COMMAND_WORD + " n/meeting";

    private final Set<String> keywords;
    private final String prefix;

    public FindCommand(String pre, Set<String> keywords) {
        this.prefix = pre;
        this.keywords = keywords;
    }

    @Override
    public CommandResult execute() {
        if (prefix.equals(PREFIX_NAME)) {
            model.updateFilteredTaskListByName(keywords);
            return new CommandResult(getMessageForTaskListShownSummary(model.getFilteredTaskList().size()));
        } else {
            model.updateFilteredTaskList(keywords);
            return new CommandResult(getMessageForTaskListShownSummary(model.getFilteredTaskList().size()));
        }
    }

}

@@ -33,16 +33,153 @@
 mands;%0A%0A
+import static seedu.taskboss.logic.parser.CliSyntax.PREFIX_NAME;%0Aimport static seedu.taskboss.logic.parser.CliSyntax.PREFIX_START_DATE;%0A%0A
 import j
@@ -433,59 +433,8 @@
 nd%22;
-%0A    public static final String PREFIX_NAME = %22/n%22;
 %0A%0A  
@@ -1257,16 +1257,53 @@
  %7D else 
+if (prefix.equals(PREFIX_START_DATE))
 %7B%0A      
@@ -1336,16 +1336,222 @@
 TaskList
+ByStartDateTime(keywords);%0A            return new CommandResult(getMessageForTaskListShownSummary(model.getFilteredTaskList().size()));%0A        %7D else %7B%0A            model.updateFilteredTaskListByEndDateTime
 (keyword
@@ -1655,32 +1655,32 @@
 ist().size()));%0A
-
         %7D%0A    %7D%0A
@@ -1672,16 +1672,17 @@
        %7D
+ 
 %0A    %7D%0A%0A

update findCommand to support find by date