package de.accso.flexinale.common.application.services;

import de.accso.flexinale.common.application.PersistMode;
import de.accso.flexinale.common.application.PersistedEntityAndResult;
import de.accso.flexinale.common.domain.model.AbstractDao;
import de.accso.flexinale.common.shared_kernel.Identifiable;
import org.apache.poi.ss.usermodel.Row;

import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;

@SuppressWarnings("unused")
public interface ExcelDataUploadService<E extends Identifiable> {
    Collection<E> loadDataFromExcelSheet(final String resourceName) throws IOException;
    Collection<E> loadDataFromExcelSheet(final InputStream stream)  throws IOException;

    int loadDataFromExcelSheetAndPersist(final String resourceName, PersistMode mode) throws IOException;
    int loadDataFromExcelSheetAndPersist(final InputStream stream, PersistMode mode) throws IOException;

    Collection<PersistedEntityAndResult<E>>
        loadDataFromExcelSheetAndPersistAndReturn(final InputStream stream, PersistMode mode) throws IOException;
    Collection<PersistedEntityAndResult<E>>
        loadDataAndPersistAndReturn(Collection<E> data, PersistMode mode);

    AbstractDao<E> getDao();
    String getNameOfExcelDataType();

    void beforeLoad(Object... o);
    void afterLoad(Object... o);
    E createDataFromExcelRow(final Row row);
}