package com.adealink.weparty.module.setting

import androidx.fragment.app.FragmentManager
import androidx.lifecycle.ViewModelStoreOwner
import com.adealink.frame.aab.BaseDynamicModule
import com.adealink.weparty.R
import com.adealink.weparty.module.setting.viewmodel.ISettingViewModel

object SettingModule : BaseDynamicModule<ISettingService>(ISettingService::class),
    ISettingService {

    override val featureName: String
        get() = "setting"

    override val moduleNameResId: Int
        get() = R.string.module_setting

    override fun emptyService(): ISettingService {
        return object : ISettingService {

            override fun getService(): ISettingService? {
                return null
            }

            override fun showLanguageSettingDialog(fragmentManager: FragmentManager) {
            }

            override fun getSettingViewModel(owner: ViewModelStoreOwner): ISettingViewModel? {
                return null
            }

            override fun onLogout() {

            }
        }
    }

    override fun showLanguageSettingDialog(fragmentManager: FragmentManager) {
        getService().showLanguageSettingDialog(fragmentManager)
    }

    override fun getSettingViewModel(owner: ViewModelStoreOwner): ISettingViewModel? {
        return getService().getSettingViewModel(owner)
    }

    override fun onLogout() {
        getService().onLogout()
    }
}