package llc.arma.ble.app.ui.screen.password.view

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.unit.dp
import llc.arma.ble.app.ui.screen.password.ChangePasswordContract

@Composable
fun Loading(
    onEvent: (ChangePasswordContract.Event) -> Unit
) {

    Column(
        modifier = Modifier.padding(20.dp)
    ) {

        CircularProgressIndicator(
            strokeCap = StrokeCap.Round,
            modifier = Modifier.align(Alignment.CenterHorizontally)
        )

        Spacer(modifier = Modifier.height(20.dp))

        Box(
            modifier = Modifier
        ) {

            Surface(
                modifier = Modifier
                    .fillMaxWidth()
                    .height(50.dp),
                shape = CircleShape,
                color = MaterialTheme.colorScheme.surfaceVariant,
                onClick = {
                    onEvent(ChangePasswordContract.Event.OnNavigateUp)
                }
            ) {

                Box(modifier = Modifier.fillMaxSize()) {

                    Text(
                        modifier = Modifier.align(Alignment.Center),
                        color = MaterialTheme.colorScheme.onSurfaceVariant,
                        style = MaterialTheme.typography.labelLarge,
                        text = "Отменить"
                    )

                }

            }

        }

    }

}