package seedu.tasklist.logic.commands;

/**
 * Shows all tasks that fulfill the category keyword.
 * Keyword matching is case insensitive.
 */
public class ShowCommand extends Command {

    public static final String COMMAND_WORD = "show";

    public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows all tasks under the requested category. "
            + "The specified keywords (case-insensitive) are shown as a list with index numbers.\n"
            + "Parameters: KEYWORD (all, incomplete, complete, p/[PRIORITY]\n"
            + "Example: " + COMMAND_WORD + " all";

    public static final String MESSAGE_SHOW_FAILURE = "Invalid category. Available categories: all, incomplete, complete, p/[PRIORITY]";
    public static final String MESSAGE_SUCCESS = "Shown requested tasks.";
    private final String keyword;
    
    public ShowCommand(String keyword) {
        this.keyword = keyword;
    }

    @Override
    public CommandResult execute() {
        if (keyword.equals("all")) {
            model.updateFilteredListToShowAll();
        }
        else if (keyword.equals("incomplete")) {
            model.updateFilteredListToShowIncomplete();
        }
        else if (keyword.equalsIgnoreCase("complete")) {
            model.updateFilteredListToShowComplete();
        }
        else if (keyword.equalsIgnoreCase("p/high") || keyword.equalsIgnoreCase("p/normal") || keyword.equalsIgnoreCase("p/low")){
            model.updateFilteredListToShowPriority(keyword);
        }
        else {
        	return new CommandResult(String.format(MESSAGE_SHOW_FAILURE));
        }
    	
        return new CommandResult(String.format(getMessageForPersonListShownSummary(model.getFilteredPersonList().size())));
    }
}
@@ -969,14 +969,15 @@
     
-    if
+%09switch
  (ke
@@ -985,38 +985,47 @@
 word
-.equals(%22all%22)) %7B%0A         
+) %7B%0A    %09%0A        case %22all%22:%0A    %09
    
+ 
 mode
@@ -1065,46 +1065,152 @@
     
+%09
     
-%7D%0A        else if (keyword.equals(
+return new CommandResult(String.format(getMessageForPersonListShownSummary(model.getFilteredPersonList().size())));%0A    %09    %0A        case 
 %22inc
@@ -1209,36 +1209,33 @@
 ase %22incomplete%22
-)) %7B
+:
 %0A            mod
@@ -1286,53 +1286,149 @@
     
- %7D%0A
      
-   else if (keyword.equalsIgnoreCase(
+return new CommandResult(String.format(getMessageForPersonListShownSummary(model.getFilteredPersonList().size())));%0A    %09%09%0A        case 
 %22com
@@ -1437,12 +1437,9 @@
 ete%22
-)) %7B
+:
 %0A   
@@ -1501,60 +1501,156 @@
     
-%7D%0A
     
-    else if (keyword.equalsIgnoreCase(
+return new CommandResult(String.format(getMessageForPersonListShownSummary(model.getFilteredPersonList().size())));%0A    %09%09%0A        case 
 %22p/high%22
 ) %7C%7C
@@ -1649,88 +1649,37 @@
 igh%22
-) %7C%7C keyword.equalsIgnoreCase(%22p/normal%22) %7C%7C keyword.equalsIgnoreCase(
+: case %22p/med%22: case 
 %22p/low%22
-))%7B
+:
 %0A   
@@ -1744,117 +1744,8 @@
     
-    %7D%0A        else %7B%0A        %09return new CommandResult(String.format(MESSAGE_SHOW_FAILURE));%0A        %7D%0A    %09%0A
     
@@ -1868,11 +1868,110 @@
 ));%0A    
+%09%0A        default:%0A            return new CommandResult(String.format(MESSAGE_SHOW_FAILURE));%0A    %09
 %7D%0A%7D

update showcommand