package com.lukouguoji.gnc.page.stash.list

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.lukouguoji.gnc.R
import com.lukouguoji.gnc.databinding.ActivityGncStashListBinding
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.ktx.getLifecycleOwner
import com.lukouguoji.module_base.router.ARouterConstants

@Route(path = ARouterConstants.ACTIVITY_URL_GNC_WAREHOUSE)
class GncStashListActivity :
    BaseBindingActivity<ActivityGncStashListBinding, GncStashListViewModel>() {
    override fun layoutId(): Int {
        return R.layout.activity_gnc_stash_list
    }

    override fun viewModelClass(): Class<GncStashListViewModel> {
        return GncStashListViewModel::class.java
    }

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国内出港仓库")
        binding.viewModel = viewModel

        viewModel.pageModel
            .bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, getLifecycleOwner())
        binding.rv.addOnItemClickListener(viewModel)

        viewModel.refresh()
    }

    companion object {
        @JvmStatic
        fun start(context: Context) {
            val starter = Intent(context, GncStashListActivity::class.java)
            context.startActivity(starter)
        }
    }

}