package seedu.taskboss.logic.parser;

import static seedu.taskboss.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.taskboss.logic.commands.Command;
import seedu.taskboss.logic.commands.IncorrectCommand;
import seedu.taskboss.logic.commands.RenameCategoryCommand;

public class RenameCategoryCommandParser {

    private static final int NUM_CATEGORIES_PARAM = 2;
    private static final int INDEX_OLD_CATEGORY = 0;
    private static final int INDEX_NEW_CATEGORY = 1;

    public Command parse(String args) {
        String[] categories = ParserUtil.parseRenameCategory(args);
        if (categories.length != NUM_CATEGORIES_PARAM) {
            return new IncorrectCommand(
                    String.format(MESSAGE_INVALID_COMMAND_FORMAT, RenameCategoryCommand.MESSAGE_USAGE));
        }
        return new RenameCategoryCommand(categories[INDEX_OLD_CATEGORY], categories[INDEX_NEW_CATEGORY]);
    }
}

@@ -481,16 +481,185 @@
 ORY = 1;
+%0A    private static final String FORMAT_ALPHANUMERIC = %22%5BA-Za-z0-9%5D+%22;%0A    private static final String ERROR_NON_ALPHANUMERIC = %22Category names should be alphanumeric.%22;
 %0A%0A    pu
@@ -972,16 +972,319 @@
        %7D
+ else if (!categories%5BINDEX_OLD_CATEGORY%5D.matches(FORMAT_ALPHANUMERIC) %7C%7C%0A            !categories%5BINDEX_NEW_CATEGORY%5D.matches(FORMAT_ALPHANUMERIC)) %7B%0A            return new IncorrectCommand(%0A                    String.format(MESSAGE_INVALID_COMMAND_FORMAT, ERROR_NON_ALPHANUMERIC));%0A        %7D %0A%0A        
 %0A       

Check for alphanumeric names::RenameCategoryCommandParser