package xyz.cottongin.radio247.ui.screens.nowplaying

import android.app.Application
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import xyz.cottongin.radio247.RadioApplication

class NowPlayingViewModelFactory(
    private val application: RadioApplication
) : ViewModelProvider.Factory {
    @Suppress("UNCHECKED_CAST")
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        if (modelClass.isAssignableFrom(NowPlayingViewModel::class.java)) {
            return NowPlayingViewModel(application) as T
        }
        throw IllegalArgumentException("Unknown ViewModel class")
    }
}
