package it.integry.integrywmsnative.core.data_store.db;

import androidx.room.Database;
import androidx.room.RoomDatabase;
import androidx.room.TypeConverters;

import it.integry.integrywmsnative.core.data_store.db.converter.DateConverter;
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloGrigliaDao;
import it.integry.integrywmsnative.core.data_store.db.dao.ArticoloOrdineDao;
import it.integry.integrywmsnative.core.data_store.db.dao.GrigliaDao;
import it.integry.integrywmsnative.core.data_store.db.dao.OrdineDao;
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloGriglia;
import it.integry.integrywmsnative.core.data_store.db.entity.ArticoloOrdine;
import it.integry.integrywmsnative.core.data_store.db.entity.Griglia;
import it.integry.integrywmsnative.core.data_store.db.entity.Ordine;

@Database(entities = {ArticoloGriglia.class, Griglia.class, Ordine.class, ArticoloOrdine.class}, version = 1, exportSchema = false)
@TypeConverters({
        DateConverter.class
})
public abstract class AppDatabase extends RoomDatabase {

//    private AppDatabase mRoomInstance;

    public abstract ArticoloGrigliaDao articoloGrigliaDao();

    public abstract GrigliaDao grigliaDao();

    public abstract OrdineDao ordineDao();

    public abstract ArticoloOrdineDao articoloOrdineDao();

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

//    public AppDatabase(Application application) {
//        mRoomInstance = Room.databaseBuilder(application,
//                AppDatabase.class, "integry_wms")
//                .fallbackToDestructiveMigration()
//                .build();
//    }


}
