package llc.arma.ble.domain.usecase

import kotlinx.coroutines.flow.Flow
import llc.arma.ble.domain.Result
import llc.arma.ble.domain.common.BleException
import llc.arma.ble.domain.common.ProgressState
import llc.arma.ble.domain.model.Ble
import llc.arma.ble.domain.repository.BleRepository
import javax.inject.Inject

class GetAccelerometerSpectreBySerial @Inject constructor(
    private val bleRepository: BleRepository
) {

    suspend operator fun invoke(
        serial: String,
        accelScale: AccelScale,
        accelMode: AccelViewMode,
        fftAxis: FftAxis,
        fftMode: FftViewMode,
        frequency: FftFrequency
    ): Flow<Result<ProgressState<List<Ble.Accelerometer.SpectrePoint>>, BleException>> {

        return bleRepository.getAccelerometerSpectreBySerial(serial, accelScale, accelMode, fftAxis, fftMode, frequency)

    }

}

enum class FftFrequency {
    OFF, F_1, F_10, F_25, F_50, F_100, F_200, F_400, F_1620, F_1344;

    companion object
}

enum class FftViewMode {
    SPECTRE, X, Y, Z;

    companion object
}

enum class FftAxis {
    AUTO, X, Y, Z;

    companion object
}