package com.sixin.module_p.ui.gnj.xieji.add

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.alibaba.fastjson.JSON
import com.lukouguoji.module_base.bean.GnjUnloadListBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.ktx.refresh
import com.sixin.module_p.R
import com.sixin.module_p.base.BasePdaActivity
import com.sixin.module_p.databinding.ActivityGnjXiejiAddBinding

class PdaGnjXieJiAddActivity :
    BasePdaActivity<ActivityGnjXiejiAddBinding, PdaGnjXieJiAddViewModel>() {
    override fun layoutId(): Int {
        return R.layout.activity_gnj_xieji_add
    }

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

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国内进港开始卸机")
        viewModel.rv = binding.rv
        binding.viewModel = viewModel
        binding.rv.addOnItemClickListener(viewModel)
        viewModel.onInit(intent)
    }

    companion object {
        @JvmStatic
        fun start(context: Context, data: GnjUnloadListBean) {
            val starter = Intent(context, PdaGnjXieJiAddActivity::class.java)
                .putExtra(Constant.Key.DATA, JSON.toJSONString(data))
            context.startActivity(starter)
        }
    }

}