package com.aiosman.riderpro.ui.login

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
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.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.aiosman.riderpro.LocalNavController
import com.aiosman.riderpro.R
import com.aiosman.riderpro.ui.NavigationRoute
import com.aiosman.riderpro.ui.composables.ActionButton

@Composable
fun LoginPage() {
    val navController = LocalNavController.current
    LaunchedEffect(Unit) {
//        navController.navigate(NavigationRoute.Index.route)
    }
    Scaffold {
        it
        Box(
            modifier = Modifier.fillMaxSize()
        ) {
            // to bottom
            Box(
                contentAlignment = Alignment.TopCenter,
                modifier = Modifier.padding(top = 211.dp)
            ) {
                Column(
                    horizontalAlignment = Alignment.CenterHorizontally,
                    modifier = Modifier.fillMaxWidth()
                ) {
                    Image(
                        painter = painterResource(id = R.mipmap.rider_pro_logo),
                        contentDescription = "Rider Pro",
                        modifier = Modifier
                            .width(108.dp)
                            .height(45.dp)
                    )
                    Spacer(modifier = Modifier.height(32.dp))
                    Text(
                        "Connecting Riders".uppercase(),
                        fontSize = 28.sp,
                        fontWeight = FontWeight.Bold
                    )
                    Text("Worldwide".uppercase(), fontSize = 28.sp, fontWeight = FontWeight.Bold)
                }

            }
            Box(
                modifier = Modifier
                    .align(Alignment.BottomCenter)
                    .padding(bottom = 82.dp + 162.dp)
            ) {
                Row(
                    modifier = Modifier.fillMaxWidth(),
                    horizontalArrangement = Arrangement.Center
                ) {
                    ActionButton(
                        modifier = Modifier
                            .width(162.dp)
                            .height(48.dp),
                        text = stringResource(R.string.login_upper),
                        backgroundImage = R.mipmap.rider_pro_grey_bg_big
                    ) {
                        navController.navigate(
                            NavigationRoute.UserAuth.route,
                        )
                    }
                    ActionButton(
                        modifier = Modifier
                            .width(162.dp)
                            .height(48.dp),
                        text = stringResource(R.string.sign_in_upper),
                        backgroundImage = R.mipmap.rider_pro_red_bg_big
                    ){
                        navController.navigate(
                            NavigationRoute.SignUp.route,
                        )
                    }
                }
            }
        }

    }
}

