package com.example.wabi.view.screeens.profile

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavHostController
import com.example.wabi.ui.theme.WabiTheme
import com.example.wabi.view.components.buttons.MainButton

@Composable
fun Profile(navHostController: NavHostController, vm: ProfileViewModel = hiltViewModel()) {

    Column(
        modifier = Modifier
            .fillMaxSize()
            .background(color = WabiTheme.colors.backgroundColor),
        verticalArrangement = Arrangement.SpaceBetween,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {


        Column(
            modifier = Modifier
                .fillMaxHeight(0.4f)
                .fillMaxWidth()
                .border(
                    width = 3.dp,
                    color = WabiTheme.colors.mainColor,
                    shape = RoundedCornerShape(topStart = 15.dp, topEnd = 15.dp)
                )
                .background(color = WabiTheme.colors.backgroundColor),
            verticalArrangement = Arrangement.SpaceBetween,
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Row(
                modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center
            ) {
                MainButton(
                    onClick = { vm.signOutCurrentUser(navHostController) },
                    textContent = "Выход",
                    color = WabiTheme.colors.error,
                    colorContent = WabiTheme.colors.onBoardLight,
                    modifier = Modifier.fillMaxWidth(0.8f)
                )
            }

            Row(
                modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center
            ) {
                MainButton(
                    onClick = { vm.signOutCurrentUser(navHostController) },
                    textContent = "Выход",
                    color = WabiTheme.colors.error,
                    colorContent = WabiTheme.colors.onBoardLight,
                    modifier = Modifier.fillMaxWidth(0.8f)
                )
            }
        }
    }
}