package de.sebse.fuplanner2.ui.details

import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import de.sebse.fuplanner2.database.AppDatabase
import de.sebse.fuplanner2.database.Course


class DetailsViewModelFactory(private val courseId: Long): ViewModelProvider.NewInstanceFactory() {
    override fun <T : ViewModel> create(modelClass: Class<T>): T = DetailsViewModel(courseId) as T
}

class DetailsViewModel(courseId: Long) : ViewModel() {
    val course: LiveData<Course> = AppDatabase.getInstance().courseDao().getCourseById(courseId)
}