package com.adealink.weparty.module.im

import android.app.Application
import com.adealink.frame.aab.BaseDynamicModule
import com.adealink.weparty.R
import com.adealink.weparty.module.profile.data.UserInfo

object IMModule : BaseDynamicModule<IIMService>(IIMService::class), IIMService {

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

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

    override fun emptyService(): IIMService {
        return object : IIMService {
            override fun getService(): IIMService? {
                return null
            }

            override fun activityOnCreateMainTask() {
            }

            override fun activityOnCreateSubTask() {
            }

            override fun appOnCreateMainTask(application: Application) {
            }

            override fun appOnCreateSubTask(application: Application) {
            }

            override fun onLogout() {
            }

            override fun isLogin(): Boolean {
                return false
            }

            override fun updateIMSelfInfo(userInfo: UserInfo?) {
            }
        }
    }

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

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

    override fun appOnCreateMainTask(application: Application) {
        getService().appOnCreateMainTask(application)
    }

    override fun appOnCreateSubTask(application: Application) {
        getService().appOnCreateSubTask(application)
    }

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

    override fun isLogin(): Boolean {
        return getService().isLogin()
    }

    override fun updateIMSelfInfo(userInfo: UserInfo?) {
        getService().updateIMSelfInfo(userInfo)
    }

}