package llc.arma.ble.app.ui.screen.rotation.statistic

import llc.arma.ble.app.ui.common.ViewEvent
import llc.arma.ble.app.ui.common.ViewSideEffect
import llc.arma.ble.app.ui.common.ViewState
import llc.arma.ble.domain.model.Rotation

class RotationStatisticContract {

    sealed class Event : ViewEvent {

        object OnNavigateUp : Event()

        object OnNavigateToDelete : Event()

        data class OnRadiusChanged(
            val radius: Long?
        ): Event()

        data class OnStartDateChanged(
            val start: Long?
        ): Event()

        data class OnStopDateChanged(
            val stop: Long?
        ): Event()

    }

    sealed class State : ViewState {

        object Loading : State()

        data class Display(
            val rotations: List<Rotation>,
            val ranges: List<RotationRange>,
            val radius: Long?,
            val startDate: Long?,
            val endDate: Long?
        ) : State() {

            data class RotationRange(
                val distance: Double,
                val startDate: Long,
                val endDate: Long,
                val maxSpeed: Double,
                val avgSpeed: Double,
                val rotations: Float,
            )

        }

    }

    sealed class Effect : ViewSideEffect {

        sealed class Navigation : Effect(){

            object NavigateUp : Navigation()

            data class NavigateToDelete(
                val serial: String
            ) : Navigation()

        }

    }

}