package com.haven.wallpapers.room;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.haven.wallpapers.jsonbean.Data;

@Database(entities = {Data.class, ImportEntry.class}, version = 1,exportSchema=false)
public abstract class AppDatabase extends RoomDatabase {
    public abstract LikeDao taskDao();
    public abstract ImportDao imageEntryDao();

    private static volatile AppDatabase INSTANCE;

    public static AppDatabase getInstance(final Context context) {
        if (INSTANCE == null) {
            synchronized (AppDatabase.class) {
                if (INSTANCE == null) {
                    INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
                                    AppDatabase.class, "app_database")
                            .build();
                }
            }
        }
        return INSTANCE;
    }
}
