package com.example.tomatoandpotatoapp.Screens

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
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.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
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.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.tomatoandpotatoapp.R
import androidx.navigation.NavController
import com.example.tomatoandpotatoapp.navigationPack.Screens


@Composable
fun ChoiceScr(
    navController: NavController
) {
    Box(
        modifier = Modifier.fillMaxSize()
    ) {
        Image(
            painter = painterResource(
                id = R.drawable.fon
            ),
            contentDescription = "Фон",
            modifier = Modifier.fillMaxSize(),
            contentScale = ContentScale.Crop
        )

        Box(
            modifier = Modifier
                .fillMaxSize()
                .background(
                    brush = Brush.verticalGradient(
                        colors = listOf(
                            Color(0xFFFFFFFF).copy(alpha = 0.4f),
                            Color(0xFF000000).copy(alpha = 0.65f)
                        ),
                        startY = 0.0f,
                        endY = 1500.0f
                    )
                )
        )


        Column(
            modifier = Modifier
                .fillMaxSize()
                .padding(vertical = 80.dp),
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.SpaceBetween
        ) {
            Column(
                modifier = Modifier.fillMaxWidth(1f),
                horizontalAlignment = Alignment.CenterHorizontally,
                verticalArrangement = Arrangement.Center
            ) {
                Image(
                    painter = painterResource(id = R.drawable.logo),
                    contentDescription = "Логотип",
                    modifier = Modifier.size(120.dp)
                )
                Text(
                    text = "Добро пожаловать в",
                    fontWeight = FontWeight.W700,
                    fontSize = 27.sp,
                    color = Color.White,
                    textAlign = TextAlign.Center
                )
                Spacer(modifier = Modifier.height(10.dp))
                Text(
                    text = "TomatoAndPotato",
                    fontWeight = FontWeight.W700,
                    fontSize = 27.sp,
                    color = Color.White,
                    textAlign = TextAlign.Center
                )
            }

            Column(
                modifier = Modifier
                    .fillMaxWidth(1f)
                    .padding(bottom = 40.dp),
                horizontalAlignment = Alignment.CenterHorizontally,
                verticalArrangement = Arrangement.Center
            ) {
                Button(
                    onClick = { navController.navigate(Screens.AuthorizationScreen.route) },
                    modifier = Modifier
                        .width(278.dp)
                        .height(45.dp),
                    shape = RoundedCornerShape(30),
                    colors = ButtonDefaults.buttonColors(
                        containerColor = Color(0xFFBCBD76)
                    )
                )
                {
                    Text(
                        text = "Вход",
                        fontSize = 20.sp,
                        fontWeight = FontWeight.W700,
                        color = Color.White
                    )
                }

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

                Button(
                    onClick = { navController.navigate(Screens.RegistrationScreen.route) },
                    modifier = Modifier
                        .width(278.dp)
                        .height(45.dp),
                    shape = RoundedCornerShape(30),
                    colors = ButtonDefaults.buttonColors(
                        containerColor = Color(0xFF78EE99)
                    )
                ) {
                    Text(
                        text = "Регистрация",
                        fontSize = 20.sp,
                        fontWeight = FontWeight.W700,
                        color = Color.White
                    )

                }
            }
        }
    }
}


