package com.example.wabi.view.screeens.logIn.items

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.example.wabi.view.components.buttons.ButtonBack
import com.example.wabi.view.screeens.logIn.LogInViewModel
import com.example.wabi.view.screeens.logIn.items.signUpItems.CreatePofile
import com.example.wabi.view.screeens.logIn.items.signUpItems.EmailAndPassword
import com.example.wabi.view.screeens.logIn.items.signUpItems.SignUpStateDestination
import com.example.wabi.view.screeens.logIn.items.signUpItems.SingUpDestinations

@Composable
fun SignUp(vm: LogInViewModel, screenState: MutableState<Int>) {
    val singUpState = remember { mutableIntStateOf(SignUpStateDestination.emailAndPassword) }

    Row(
        modifier = Modifier.fillMaxWidth()
    ) {
        ButtonBack(onClick = {
            screenState.value = LogInStateDestinations.signIn
        }, modifier = Modifier.padding(10.dp))
    }

    when (singUpState.intValue) {
        SignUpStateDestination.emailAndPassword -> EmailAndPassword(
            station = SingUpDestinations.emailAndPassword, stationChanger = singUpState, vm = vm
        )

        SignUpStateDestination.createProfile -> CreatePofile(
            station = SingUpDestinations.profile, vm = vm
        )
    }
}