package com.example.chemical.ui.plan.room;

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

import com.blankj.utilcode.util.Utils;
import com.example.chemical.BuildConfig;
import com.example.chemical.ui.plan.room.bean.input_add.InventoryItemBean;
import com.example.chemical.ui.plan.room.bean.locker.CabinetLayerSelect;
import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetDoorVo;
import com.example.chemical.ui.plan.room.bean.locker.HxpCabinetVo;
import com.example.chemical.ui.plan.room.bean.locker.HxpLabDirector;
import com.example.chemical.ui.plan.room.bean.locker.HxpLabSafe;
import com.example.chemical.ui.plan.room.dao.HxpCabinetDAO;
import com.example.chemical.ui.plan.room.dao.HxpDoorDAO;
import com.example.chemical.ui.plan.room.dao.HxpInventoryDAO;
import com.example.chemical.ui.plan.room.dao.HxpLabDirectorDAO;
import com.example.chemical.ui.plan.room.dao.HxpLabSafeDAO;
import com.example.chemical.ui.plan.room.dao.HxpLayerDAO;

@Database(entities = {HxpCabinetVo.class,
        HxpCabinetDoorVo.class,
        CabinetLayerSelect.class,
        HxpLabDirector.class,
        HxpLabSafe.class,
        InventoryItemBean.class},
        version = BuildConfig.VERSION_CODE, exportSchema = false)
public abstract class RoomTool extends RoomDatabase {

    private static RoomTool INSTANCE;

    public static synchronized RoomTool getInstance() {
        if (INSTANCE == null) {
            INSTANCE = Room.databaseBuilder(Utils.getApp(), RoomTool.class, "hxp_db").allowMainThreadQueries().build();
        }
        return INSTANCE;
    }

    // 柜子
    public abstract HxpCabinetDAO hxpCabinetDAO();

    // 柜门
    public abstract HxpDoorDAO hxpDoorDAO();

    // 柜层
    public abstract HxpLayerDAO hxpLayerDAO();

    // 待入库清单item
    public abstract HxpInventoryDAO hxpInventoryDAO();

    // 实验室责任人
    public abstract HxpLabDirectorDAO hxpLabDirectorDAO();

    // 实验室安全员
    public abstract HxpLabSafeDAO hxpLabSafeDAO();
}
