// VoiceDetailApp
package com.example.voicedetailapp

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.ui.graphics.Color
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Button
import androidx.compose.material3.Scaffold
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.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.voicedetailapp.ui.theme.VoiceDetailAppTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            VoiceDetailAppTheme {
                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
                    VoterReg(
                        modifier = Modifier.padding(innerPadding)
                    )
                }
            }
        }
    }
}

@Composable
fun VoterReg( modifier: Modifier = Modifier) {
    var name by remember { mutableStateOf( value = "") }
    var nin by remember { mutableStateOf( value = "") }
    var gender by remember { mutableStateOf( value = "")}
    var village by remember {mutableStateOf( value = "")}
    var district by remember {mutableStateOf( value = "")}
    var county by remember {mutableStateOf( value = "")}

    Column(
        verticalArrangement = Arrangement.SpaceAround,
        horizontalAlignment = Alignment.CenterHorizontally,
        modifier = Modifier
            .fillMaxSize()
            .background(Color.White)
            .padding(10.dp)

    ) {
        Text(
            text = "VOTER DETAILS",
            fontSize = 30.sp,
            color = Color.Red,
            fontWeight = FontWeight.Bold,
            textDecoration = TextDecoration.Underline

        )
        Row(
            horizontalArrangement = Arrangement.SpaceAround,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()

        ) {
            Text(
                text = "NAME:",
                fontWeight = FontWeight.Bold,
                fontSize = 30.sp,
                color = Color.Black
            )
            TextField(
                value = "name",
                onValueChange = {name = it},
                label = {
                    Text(
                        text = "Enter Name",
                        fontSize = 20.sp
                    )
                },
                modifier = Modifier
                    .width(200.dp)
            )

        }
        Row(
            horizontalArrangement = Arrangement.SpaceAround,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()

        ) {
            Text(
                text = "GENDER:",
                fontWeight = FontWeight.Bold,
                fontSize = 30.sp,
                color = Color.Black
            )
            TextField(
                value = "gender",
                onValueChange = {gender = it},
                label = {
                    Text(
                        text = "Enter Gender",
                        fontSize = 20.sp
                    )
                },
                modifier = Modifier
                    .width(200.dp)
            )

        }
        Row(
            horizontalArrangement = Arrangement.SpaceAround,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()

        ) {
            Text(
                text = "VILLAGE:",
                fontWeight = FontWeight.Bold,
                fontSize = 30.sp,
                color = Color.Black
            )
            TextField(
                value = "vilage",
                onValueChange = {village = it},
                label = {
                    Text(
                        text = "Enter Village",
                        fontSize = 20.sp
                    )
                },
                modifier = Modifier
                    .width(200.dp)
            )

        }
        Row(
            horizontalArrangement = Arrangement.SpaceAround,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()

        ) {
            Text(
                text = "NIN:",
                fontWeight = FontWeight.Bold,
                fontSize = 30.sp,
                color = Color.Black
            )
            TextField(
                value = "nin",
                onValueChange = {nin = it},
                label = {
                    Text(
                        text = "Enter nin",
                        fontSize = 20.sp
                    )
                },
                modifier = Modifier
                    .width(200.dp)
            )

        }
        Row(
            horizontalArrangement = Arrangement.SpaceAround,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()

        ) {
            Text(
                text = "DISTRICT:",
                fontWeight = FontWeight.Bold,
                fontSize = 30.sp,
                color = Color.Black
            )
            TextField(
                value = "district",
                onValueChange = {district = it},
                label = {
                    Text(
                        text = "Enter District",
                        fontSize = 20.sp
                    )
                },
                modifier = Modifier
                    .width(200.dp)
            )

        }
        Row(
            horizontalArrangement = Arrangement.SpaceAround,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()

        ) {
            Text(
                text = "COUNTY:",
                fontWeight = FontWeight.Bold,
                fontSize = 30.sp,
                color = Color.Black
            )
            TextField(
                value = "county",
                onValueChange = {county = it},
                label = {
                    Text(
                        text = "Enter Country",
                        fontSize = 20.sp
                    )
                },
                modifier = Modifier
                    .width(200.dp)
            )

        }
        Row(
            horizontalArrangement = Arrangement.SpaceAround,
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()

        ){
            Button(onClick = {}) {
                Text(
                    text = "SAVE",
                    fontSize = 20.sp
                )
            }
            Button(onClick = {}) {
                Text(
                    text = "CANCEL",
                    fontSize = 20.sp,
                )
            }
        }


    }



}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    VoiceDetailAppTheme {
        VoterReg(modifier = Modifier)
    }
}