package id.ac.ubharajaya.panicbutton

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp

class JalurEvakuasiActivity : ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val denah = intent.getStringExtra("denah") ?: "utara"

        setContent {
            JalurEvakuasiScreen(denah)
        }
    }
}

@Composable
fun JalurEvakuasiScreen(denah: String) {

    val gambar = when (denah) {
        "utara" -> R.drawable.evakuasiutara
        "selatan" -> R.drawable.evakuasiselatan
        "labkomp" -> R.drawable.evakuasi_lab_kompemrograman
        else -> R.drawable.evakuasiutara
    }

    Column(modifier = Modifier.fillMaxSize().padding(16.dp)) {

        Text(
            text = "Jalur Evakuasi ($denah)",
            style = MaterialTheme.typography.headlineSmall
        )

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

        Image(
            painter = painterResource(id = gambar),
            contentDescription = "Denah Evakuasi",
            modifier = Modifier.fillMaxWidth()
        )
    }
}