package com.lukouguoji.gnc.page.distribution.handover

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.lukouguoji.gnc.R
import com.lukouguoji.gnc.databinding.ActivityDistributionHandoverBinding
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.ktx.loge

class GncDistributionHandoverActivity :
    BaseBindingActivity<ActivityDistributionHandoverBinding, GncDistributionHandoverViewModel>() {

    override fun layoutId() = R.layout.activity_distribution_handover

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

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国内出港单证交接")
        binding.viewModel = viewModel
        viewModel.initOnCreated()

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

        binding.rv.addOnItemClickListener(viewModel)
    }

    override fun onResume() {
        super.onResume()
        viewModel.refresh()
    }

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

}