package seedu.task.storage;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;

import seedu.task.commons.events.model.TaskListChangedEvent;
import seedu.task.commons.events.storage.DataSavingExceptionEvent;
import seedu.task.commons.exceptions.DataConversionException;
import seedu.task.model.ReadOnlyTaskList;
import seedu.task.model.UserPrefs;

/**
 * API of the Storage component
 */
public interface Storage extends TaskListStorage, UserPrefsStorage {

    @Override
    Optional<UserPrefs> readUserPrefs() throws DataConversionException, IOException;

    @Override
    void saveUserPrefs(UserPrefs userPrefs) throws IOException;

    @Override
    String getTaskListFilePath();

    @Override
    Optional<ReadOnlyTaskList> readTaskList() throws DataConversionException, IOException;

    @Override
    void saveTaskList(ReadOnlyTaskList taskList) throws IOException;

    /**
     * Saves the current version of the Address Book to the hard disk.
     *   Creates the data file if it is missing.
     * Raises {@link DataSavingExceptionEvent} if there was an error during saving.
     */
    void handleTaskListChangedEvent(TaskListChangedEvent abce);

    //@@author A0163559U
    /**
     * Attempts to save current version of the Task Manager to new file location
     * @param taskList
     * @param saveFile
     * @throws IOException
     */
    @Override
    void saveTaskListInNewLocation(ReadOnlyTaskList taskList, File saveFile) throws IOException;

    /**
     * Attempts to load Task Manager data from specified file location
     * @param loadFile
     * @return
     * @throws DataConversionException
     * @throws FileNotFoundException
     */
    @Override
    Optional<ReadOnlyTaskList> loadTaskListFromNewLocation(File loadFile)
            throws FileNotFoundException, DataConversionException;

    //@@author
}

@@ -1354,16 +1354,53 @@
 taskList
+ is the Task Manager data to be saved
 %0A     * 
@@ -1410,24 +1410,45 @@
 ram saveFile
+ is the save location
 %0A     * @thr
@@ -1454,32 +1454,56 @@
 rows IOException
+ if file operation fails
 %0A     */%0A    @Ov
@@ -1708,16 +1708,59 @@
 loadFile
+ is the file to load Task Manager data from
 %0A     * 
@@ -1801,24 +1801,49 @@
 ionException
+ if data conversion fails
 %0A     * @thr
@@ -1863,24 +1863,49 @@
 undException
+ if the file is not found
 %0A     */%0A   

improve comments