package llc.arma.ble.domain.usecase

import android.app.Application
import llc.arma.ble.R
import llc.arma.ble.domain.model.Ble
import llc.arma.ble.domain.repository.EmailRepository
import llc.arma.ble.domain.repository.XlsxRepository
import org.apache.poi.ss.SpreadsheetVersion
import org.apache.poi.ss.usermodel.WorkbookFactory
import org.apache.poi.ss.util.AreaReference
import org.apache.poi.ss.util.CellReference
import org.apache.poi.util.IOUtils
import org.apache.poi.xssf.usermodel.XSSFCell
import org.apache.poi.xssf.usermodel.XSSFSheet
import org.apache.poi.xssf.usermodel.XSSFTable
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.util.UUID
import javax.inject.Inject

class ExportToXlsx @Inject constructor(
    private val xlsxRepository: XlsxRepository,
    private val emailRepository: EmailRepository
) {

    operator fun invoke(
        bleName: String,
        data: List<Ble.Accelerometer.HistoryPoint>
    ){

        val file = xlsxRepository.exportToXls(bleName, data)
        emailRepository.sendFile(file)

    }

}