package com.adealink.weparty.commonui

import androidx.lifecycle.LifecycleOwner
import com.adealink.frame.mvvm.view.ViewComponent

open class BaseViewComponent(lifecycleOwner: LifecycleOwner) : ViewComponent(lifecycleOwner) {

    override fun onCreate() {
        super.onCreate()
        initViews()
        initViewComponent()
        observeViewModel()
        loadData()
    }

    open fun initViews() {

    }

    open fun initViewComponent() {

    }

    open fun observeViewModel() {

    }

    open fun loadData() {

    }

    fun showLoading() {
        (activity as? BaseActivity)?.showLoading()
    }

    fun dismissLoading() {
        (activity as? BaseActivity)?.dismissLoading()
    }
}