package com.remax.visualnovel.app.di

import androidx.lifecycle.ViewModelProvider
import com.remax.visualnovel.app.base.app.AppViewModelFactory
import com.remax.visualnovel.app.base.app.CommonApplicationProxy
import com.remax.visualnovel.app.viewmodel.AppGlobalViewModel
import com.remax.visualnovel.app.viewmodel.AppIMViewModel
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

/**
 * [AppIMViewModel] 提供者
 */
@InstallIn(SingletonComponent::class)
@Module
object ViewModelModule {

    @Singleton
    @Provides
    fun provideAppIMViewModel(factory: AppViewModelFactory) =
        ViewModelProvider(CommonApplicationProxy.viewModelStore, factory)[AppIMViewModel::class.java]

    @Singleton
    @Provides
    fun provideAppGlobalViewModel(factory: AppViewModelFactory) =
        ViewModelProvider(CommonApplicationProxy.viewModelStore, factory)[AppGlobalViewModel::class.java]

}