package com.projectdolphin.data.database;

import android.content.Context;

import java.util.LinkedList;
import java.util.List;

import com.projectdolphin.data.model.Assignment;
import com.projectdolphin.data.model.Category;
import com.projectdolphin.data.model.Class;

/**
 * Singleton for keeping the database alive throughout the application's life.
 * Based on example found at: http://www.androiddesignpatterns.com/2012/05/correctly-managing-your-sqlite-database.html
 */
public class DBAccessHelper {

    public static final String CLASS_DB_ID_INTENT_KEY = "CLASS_DB_ID_INTENT_KEY";
    public static final String CATEGORY_DB_ID_INTENT_KEY = "CATEGORY_DB_ID_INTENT_KEY";
    public static final String ASSIGNMENT_DB_ID_INTENT_KEY = "ASSIGNMENT_DB_ID_INTENT_KEY";

    public static DBAccessHelper getInstance(Context context) {
        if(instance == null)
            instance = new DBAccessHelper(context);
        return instance;
    }
    private DBAccessHelper(Context context) {
        openHelper = new CategorySQLiteOpenHelper(context.getApplicationContext());
    }
    private static DBAccessHelper instance;

    /* Class methods */

    public List<Class> getAllClasses() {
        //TODO: Implement this using the openHelper
        return new LinkedList<>();
    }
    public Class getClassByID(long CLASS_DB_ID) {
        //TODO: Implement this using the openHelper
        return new Class(-1, 0, 1.0, 4.0, "title", new LinkedList<Integer>());
    }
    public void updateClass(Class _class) {
        //TODO: Implement this using the openHelper
    }
    public void insertClass(Class _class) {
        //TODO: Implement this using the openHelper
    }

    /* Category methods */
    public List<Category> getAllCategoriesForClassID(long CLASS_DB_ID) {
        //TODO: Implement this using the openHelper
        return new LinkedList<>();
    }
    public Category getCategoryByID(long CLASS_DB_ID) {
        //TODO: Implement this using the openHelper
        return new Category(-1, -1, 0, 1.0, 4.0, "title", new LinkedList<Integer>());
    }
    public void updateCategory(Category category) {
        //TODO: Implement this using the openHelper
    }
    public void insertCategory(Category category) {
        //TODO: Implement this using the openHelper
    }

    /* Assignment methods */
    public List<Assignment> getAllCategoriesForCategoryID(long CATEGORY_DB_ID) {
        //TODO: Implement this using the openHelper
        return new LinkedList<>();
    }
    public Assignment getAssignmentByID(long ASSIGNMENT_DB_ID) {
        //TODO: Implement this using the openHelper
        return new Assignment(-1, -1, 0, 1.0, 4.0, "title");
    }
    public void updateAssignment(Assignment category) {
        //TODO: Implement this using the openHelper
    }
    public void insertAssignment(Assignment category) {
        //TODO: Implement this using the openHelper
    }

    private CategorySQLiteOpenHelper openHelper;
}

@@ -1662,32 +1662,142 @@
 openHelper%0A    %7D
+%0A    public void removeClassByID(long CLASS_DB_ID) %7B%0A        //TODO: Implement this using the openHelper%0A    %7D
 %0A%0A    /* Categor
@@ -2386,32 +2386,148 @@
 openHelper%0A    %7D
+%0A    public void removeCategoryByID(long CATEGORY_DB_ID) %7B%0A        //TODO: Implement this using the openHelper%0A    %7D
 %0A%0A    /* Assignm
@@ -3005,32 +3005,32 @@
 penHelper%0A    %7D%0A
-
     public void 
@@ -3122,24 +3122,144 @@
 Helper%0A    %7D
+%0A    public void removeAssignmentByID(long ASSIGNMENT_DB_ID) %7B%0A        //TODO: Implement this using the openHelper%0A    %7D
 %0A%0A    privat

Add remove methods that I had forgotten