package com.example.quiz.data.database;

import android.content.Context;

import androidx.room.Room;



public class DatabaseClient {

    private static DatabaseClient instance;
    private AppDataBase appDatabase;
    private Context context;

    private DatabaseClient(Context context) {
        this.context = context;
        appDatabase = Room.databaseBuilder(context,
                        AppDataBase.class, "QuizDB")
                .fallbackToDestructiveMigration()
                .build();
    }

    public static synchronized DatabaseClient getInstance(Context context) {
        if (instance == null) {
            instance = new DatabaseClient(context);
        }
        return instance;
    }

    public AppDataBase getAppDatabase() {
        return appDatabase;
    }
}

