package seedu.todo.controllers.concerns;

import seedu.todo.models.TodoListDB;
import seedu.todo.ui.UiManager;
import seedu.todo.ui.views.ConfigView;
import seedu.todo.ui.views.IndexView;

/**
 * Class to store rendering methods to be shared across controllers.
 * 
 * @author louietyj
 *
 */
public class Renderer {

    private static final String MESSAGE_DISAMBIGUATE = "Your last command wasn't clear, please fix your command and try again.";
    
    /**
     * Renders an error message in both the console and the input field, leave null or empty string if not needed.
     * @param replacedCommand    Value to display in the input field
     * @param detailedError       Message to be rendered in the console
     */
    public static void renderDisambiguation(String replacedCommand, String detailedError) {
        // Update console input field
        if (replacedCommand != null && replacedCommand.length() > 0) {
            UiManager.updateConsoleInputValue(replacedCommand);
        }
        
        // Update console message
        if (detailedError != null && detailedError.length() > 0) {
            UiManager.updateConsoleMessage(String.format("%s\n\n%s", MESSAGE_DISAMBIGUATE, detailedError));
        } else {
            UiManager.updateConsoleMessage(String.format("%s", MESSAGE_DISAMBIGUATE));
        }
    }
    
    /**
     * Renders the indexView.
     * 
     * @param db
     * @param consoleMessage to be rendered in console, leave null if not needed
     */
    public static void renderIndex(TodoListDB db, String consoleMessage) {
        IndexView view = UiManager.loadView(IndexView.class);
        view.tasks = db.getAllTasks();
        view.events = db.getAllEvents();
        UiManager.renderView(view);
        
        if (consoleMessage != null) {
            UiManager.updateConsoleMessage(consoleMessage);
        }
    }
    
    /**
     * Renders the ConfigView.
     * 
     * @param consoleMessage to be rendered in console, leave null if not needed
     */
    public static void renderConfig(String consoleMessage) {
        ConfigView view = UiManager.loadView(ConfigView.class);
        UiManager.renderView(view);
        
        if (consoleMessage != null) {
            UiManager.updateConsoleMessage(consoleMessage);
        }
    }

}

@@ -35,16 +35,103 @@
 cerns;%0A%0A
+import java.util.List;%0A%0Aimport seedu.todo.models.Event;%0Aimport seedu.todo.models.Task;%0A
 import s
@@ -1566,32 +1566,698 @@
  needed%0A     */%0A
+    public static void renderSelected(TodoListDB db, String consoleMessage, List%3CTask%3E tasks, List%3CEvent%3E events) %7B%0A        IndexView view = UiManager.loadView(IndexView.class);%0A        %0A        if (tasks != null) %7B%0A            view.tasks = tasks;%0A        %7D%0A        %0A        if (events != null) %7B%0A            view.events = events;%0A        %7D%0A        %0A        UiManager.renderView(view);%0A        %0A        if (consoleMessage != null) %7B%0A            UiManager.updateConsoleMessage(consoleMessage);%0A        %7D%0A    %7D%0A    %0A    /**%0A     * Renders the indexView.%0A     * %0A     * @param db%0A     * @param consoleMessage to be rendered in console, leave null if not needed%0A     */%0A
     public stati

create new method for renderer to render selected