package jfdi.storage;

import java.util.Arrays;
import java.util.List;

import jfdi.storage.records.Alias;
import jfdi.storage.records.Task;

/**
 * This class file contains all the constants used within the Storage component.
 *
 * @author Thng Kai Yuan
 */
public class Constants {

    // Filenames
    public static final String FILENAME_TASK = "tasks.txt";
    public static final String FILENAME_ALIAS = "aliases.txt";
    public static final String[] ARRAY_FILENAMES = {Constants.FILENAME_TASK, Constants.FILENAME_ALIAS};

    // File extensions
    public static final String EXTENSION_BACKUP = ".bak";

    // Empty stuff
    public static final String EMPTY_STRING = "";
    public static final String EMPTY_LIST_STRING = "[]";

    // Error messages
    public static final String MESSAGE_INVALID_PATH = "The directory %s cannot be used to store the program data.";
    public static final String MESSAGE_UNINITIALIZED_STORAGE = "Storage needs to be initialized first.";

    // Default charset
    public static final String CHARSET = "UTF-8";

    // Test-specific constants
    public static final String TEST_DIRECTORY_PREFIX = "CS2103-JFDI";
    public static final String TEST_DIRECTORY_NAME = "Data";
    public static final String TEST_SUBDIRECTORY_NAME = "Data2";
    public static final String TEST_FILE_NAME = "test.txt";
    public static final String TEST_FILE_DATA = "hello world!";
    public static final String TEST_ALIAS = "somealias";
    public static final String TEST_COMMAND = "somecommand";
    public static final String TEST_ALIAS_2 = "somealias2";
    public static final String TEST_COMMAND_2 = "somecommand2";

    // List of records
    private static final List<Class<?>> RECORDS = Arrays.asList(Task.class, Alias.class);

    /**
     * @return an immutable array of record classes
     */
    public static Class<?>[] getRecords() {
        return RECORDS.toArray(new Class<?>[RECORDS.size()]);
    }

}

@@ -16,16 +16,76 @@
 orage;%0A%0A
+import java.time.Duration;%0Aimport java.time.LocalDateTime;%0A%0A
 import j
@@ -1141,16 +1141,29 @@
 nstants%0A
+    // Files%0A
     publ
@@ -1224,16 +1224,16 @@
 -JFDI%22;%0A
-
     publ
@@ -1473,16 +1473,32 @@
 world!%22;
+%0A%0A    // Aliases
 %0A    pub
@@ -1664,24 +1664,24 @@
 omealias2%22;%0A
-
     public s
@@ -1729,24 +1729,434 @@
 command2%22;%0A%0A
+    // Tasks%0A    public static final String TEST_TASK_DESCRIPTION = %22my favourite description%22;%0A    public static final String TEST_TASK_TAG_1 = %22tagged%22;%0A    public static final LocalDateTime TEST_TASK_STARTDATETIME = LocalDateTime.MIN;%0A    public static final LocalDateTime TEST_TASK_ENDDATETIME = LocalDateTime.MAX;%0A    public static final Duration TEST_TASK_REMINDER_DURATION = Duration.ZERO.plusDays(1);%0A%0A
     // List 

Add constants used in TaskTest