package llc.arma.ble.app.ui.screen.connection

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.app.ui.model.BleView
import llc.arma.ble.app.ui.screen.inspection.accelerometer.AccelerometerContract
import llc.arma.ble.app.ui.screen.inspection.beacon.BeaconContract
import llc.arma.ble.app.ui.screen.inspection.thermometer.ThermometerContract
import llc.arma.ble.domain.common.BleException
import llc.arma.ble.domain.model.Ble
import llc.arma.ble.domain.usecase.GetBleBySerial

class ConnectionContract {

    sealed class Event : ViewEvent {

        object RefreshBle : Event()

        object OnNavigateUp : Event()

        data class OnBeaconNavigationEvent(
            val event: BeaconContract.Effect.Navigation
        ) : Event()

        data class OnThermometerNavigationEvent(
            val event: ThermometerContract.Effect.Navigation
        ) : Event()

        data class OnAccelNavigationEvent(
            val event: AccelerometerContract.Effect.Navigation
        ) : Event()


    }

    sealed class State : ViewState {

        object Loading : State()

        data class DisplayException(
            val exception: BleException
        ) : State()

        data class Display(
            val ble: Ble
        ) : State()

    }

    sealed class Effect : ViewSideEffect {

        sealed class Navigation : Effect() {

            object NavigateUp : Navigation()

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

        }

    }

}