package com.lukouguoji.gjj.activity

import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.ActivityGjjTallyDetailsBinding
import com.lukouguoji.gjj.viewModel.GjjTallyDetailsViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.noNull

class GjjTallyDetailsActivity :
    BaseBindingActivity<ActivityGjjTallyDetailsBinding, GjjTallyDetailsViewModel>() {

    override fun layoutId() = R.layout.activity_gjj_tally_details

    override fun viewModelClass() = GjjTallyDetailsViewModel::class.java

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国际进港理货详情")
        viewModel.mfId = intent.getStringExtra(Constant.Key.ID).noNull()
        viewModel.waybillNo = intent.getStringExtra(Constant.Key.WAYBILL).noNull()
        binding.viewModel = viewModel

        viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
        viewModel.refresh()
    }

    companion object {
        @JvmStatic
        fun start(context: Context, mfId: String, waybillNo: String) {
            val starter = Intent(context, GjjTallyDetailsActivity::class.java)
                .putExtra(Constant.Key.ID, mfId)
                .putExtra(Constant.Key.WAYBILL, waybillNo)
            context.startActivity(starter)
        }
    }
}