package com.atridad.openclimb.ui.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.atridad.openclimb.data.repository.ClimbRepository

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