package com.lukouguoji.gjc.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.databinding.ActivityIntExpArriveReceiptBinding
import com.lukouguoji.gjc.viewModel.IntExpArriveReceiptViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.bean.GjcHaWb
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.refresh

/**
 * 国际出港运抵-回执内容页（5.5寸手机版专属只读新页，平板端无对应页面）
 *
 * 数据来自主列表页已加载的 haWbList，零新增请求。
 * 对应设计稿 documents/5.5寸手持端设计文件/04_出港运抵/receipt.html。
 */
class IntExpArriveReceiptActivity :
    BaseBindingActivity<ActivityIntExpArriveReceiptBinding, IntExpArriveReceiptViewModel>() {

    override fun layoutId() = R.layout.activity_int_exp_arrive_receipt
    override fun viewModelClass() = IntExpArriveReceiptViewModel::class.java

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("回执内容")
        binding.viewModel = viewModel

        viewModel.initOnCreated(intent)
        viewModel.receiptList.observe(this) { binding.rv.refresh(it) }
    }

    companion object {
        @JvmStatic
        fun start(context: Context, wbNo: String, haWbList: ArrayList<GjcHaWb>) {
            val starter = Intent(context, IntExpArriveReceiptActivity::class.java)
                .putExtra(Constant.Key.CODE, wbNo)
                .putExtra(Constant.Key.DATA, haWbList)
            context.startActivity(starter)
        }
    }
}
