package com.bassbooster.soundeffects.equalizer.base

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.bassbooster.soundeffects.equalizer.data.api.ApiHelper
import com.bassbooster.soundeffects.equalizer.data.repository.MainRepository

import com.bassbooster.soundeffects.equalizer.viewmodel.MainViewModel

class ViewModelFactory(private val apiHelper: ApiHelper) : ViewModelProvider.Factory {

    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        if (modelClass.isAssignableFrom(MainViewModel::class.java)) {

            return MainViewModel(MainRepository(apiHelper)) as T
        }
        throw IllegalArgumentException("Unknown class name")
    }
}
