package com.example.iplace.main.viewModel.dataView

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
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.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import com.example.iplace.R
import com.example.iplace.domain.Constants.supabase
import com.example.iplace.main.viewModel.MainViewModel
import com.example.iplace.ui.theme.beige_white
import com.example.iplace.ui.theme.brown_contrast
import io.github.jan.supabase.storage.storage


@Composable
fun SplashScreen(navController: NavHostController){
    val viewModel = MainViewModel()
    val headlinesOswald = FontFamily( //выбор шрифта
        Font(resId = R.font.headlines_oswald)
    )
    val basicNunitosans = FontFamily(
        Font(resId = R.font.basic_nunitosans)
    )
    val otherInter = FontFamily(
        Font(resId = R.font.other_inter)
    )
    Image(
        painter = painterResource(id = R.drawable.sp1),
        contentDescription = "",
        contentScale = ContentScale.FillHeight,
        modifier = Modifier.fillMaxSize()
    )
    Column(
        modifier = Modifier
            .fillMaxSize(),
        verticalArrangement = Arrangement.SpaceBetween,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Spacer(modifier = Modifier.height(120.dp)) //отступы между блоками
        Text(
            text = "I.PLACE",
            fontSize = 55.sp,
            fontWeight = FontWeight.Bold,
            fontFamily = headlinesOswald,
            color = Color.White
        )
        Box(
            modifier = Modifier
                .fillMaxWidth()

                .height(210.dp)
                .width(400.dp)
                .clip(RoundedCornerShape(40.dp)) //закругление углов формы
                .background(beige_white.copy(alpha = 0.8f))
//                .alpha(0.5f)
//                .graphicsLayer {
//                    this.alpha = 0.5f
//                }
//                .alpha(0.8f) //прозрачность формы
        ) {
            Column(
                modifier = Modifier.fillMaxSize(),
                verticalArrangement = Arrangement.Top,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Spacer(modifier = Modifier.height(20.dp))
                Text(
                    text = "Добро пожаловать в I.Place",
                    fontSize = 20.sp,
                    fontWeight = FontWeight.Bold,
                    fontFamily = headlinesOswald //применение шрифта к тексту
                )

                Spacer(modifier = Modifier.height(16.dp))
                Button(
                    onClick = {navController.navigate("selectEnter")},
                    modifier = Modifier.width(200.dp).height(70.dp),
                    colors = ButtonDefaults.buttonColors(brown_contrast) //применение своего цвета
                ) {
                    Text( text = "Начать",
                        fontSize = 24.sp,
                        fontFamily = otherInter)
                }
            }
        }
    }
}

