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

import java.util.List;
import java.util.concurrent.ExecutorService;

import javax.inject.Inject;
import javax.inject.Singleton;

import io.reactivex.rxjava3.core.Flowable;
import it.integry.integrywmsnative.core.data_store.db.dao.InventarioRowDao;
import it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO;

@Singleton
public class InventarioRowLocalDataSource extends _BaseRoomDataSource<InventarioRowRoomDTO, InventarioRowDao> {

    @Inject
    public InventarioRowLocalDataSource(ExecutorService executorService, InventarioRowDao entityDao) {
        super(executorService, entityDao, InventarioRowRoomDTO.TABLE_NAME);
    }

    @Override
    public List<InventarioRowRoomDTO> makeSynchronousRetrieveAllRequest(boolean onlyToBeSync) {
        return entityDao
                .selectAll(onlyToBeSync);
    }

    @Override
    public Flowable<List<InventarioRowRoomDTO>> makeSynchronousRetrieveAllLive(boolean onlyToBeSync) {
        return entityDao
                .selectAllFlowable(-1, false, onlyToBeSync);
    }

    public Flowable<List<InventarioRowRoomDTO>> makeSynchronousRetrieveAllLive(long parentId, boolean reversed, boolean onlyToBeSync) {
        return entityDao
                .selectAllFlowable(parentId, reversed, onlyToBeSync);
    }
}
