package com.example.todokmp.android

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import com.example.todokmp.android.ui.TodoApp
import com.example.todokmp.android.ui.theme.TodoKmpTheme
import com.example.todokmp.db.DatabaseDriverFactory
import com.example.todokmp.db.TodoRepository

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

        val repository = TodoRepository(DatabaseDriverFactory(applicationContext))
        val viewModel = TodoViewModel(repository)

        setContent {
            TodoKmpTheme {
                TodoApp(viewModel = viewModel)
            }
        }
    }
}
