package llc.arma.ble.domain.usecase

import llc.arma.ble.domain.model.Ble
import llc.arma.ble.domain.repository.EmailRepository
import llc.arma.ble.domain.repository.XlsxRepository
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.exportAccelDataToXls(bleName, data)
        emailRepository.sendFile(file)

    }

    @JvmName("invokeHost")
    operator fun invoke(
        bleName: String,
        data: List<Ble.Host.HistoryPoint>
    ){

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

    }

}