package xyz.cottongin.radio247.ui.screens.stationlist

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

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