package com.syaroful.agrilinkvocpro

import android.content.res.Configuration
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import com.syaroful.agrilinkvocpro.core.components.AppButton
import com.syaroful.agrilinkvocpro.core.components.AppPasswordField
import com.syaroful.agrilinkvocpro.core.components.AppTextField
import com.syaroful.agrilinkvocpro.ui.pages.HomeScreen
import com.syaroful.agrilinkvocpro.ui.theme.AgrilinkVocproTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            AgrilinkVocproTheme {
                HomeScreen()
            }
        }
    }
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {

    Column {
        Text(
            text = "Hello $name!, silahkan Login",
            modifier = modifier.fillMaxWidth(),
            textAlign = TextAlign.Center
        )
        AppTextField(
            hint = "Enter Your Email",
            leadingIcon = painterResource(R.drawable.icon_email),
            keyboardType = KeyboardType.Email
        )
        AppPasswordField(
            hint = "Enter your password",
            keyboardType = KeyboardType.Password
        )
        AppButton(
            label = "Login",
            onClick = {}
        )
   }

}

@Preview(showBackground = true, name = "Light Mode")
@Preview(showBackground = true, name = "Dark Mode", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
fun GreetingPreview() {
    AgrilinkVocproTheme {
        HomeScreen()
    }
}