package id.ac.ubharajaya.panicbutton

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.lifecycle.ViewModelProvider
import androidx.compose.material3.MaterialTheme

class MainActivity : ComponentActivity() {
    private lateinit var viewModel: MainViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        viewModel = ViewModelProvider(this).get(MainViewModel::class.java)

        val openEvacMaps = {
            startActivity(Intent(this, EvacuationMapsActivity::class.java))
        }
        setContent {
            MaterialTheme {
                MainScreen(viewModel = viewModel, onOpenEvacMaps = openEvacMaps)
            }
        }
    }
}
