package com.lukouguoji.aerologic.page.gnj.unload.add

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.alibaba.fastjson.JSON
import com.lukouguoji.aerologic.R
import com.lukouguoji.aerologic.databinding.ActivityGnjUnloadAddBinding
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.bean.GnjUnloadListBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.addOnItemClickListener

class GnjUnloadAddActivity :
    BaseBindingActivity<ActivityGnjUnloadAddBinding, GnjUnloadAddViewModel>() {

    override fun layoutId() = R.layout.activity_gnj_unload_add

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

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国内进港开始卸机")

        binding.viewModel = viewModel
        viewModel.rv = binding.rv
        binding.rv.addOnItemClickListener(viewModel)

        viewModel.initOnCreate(intent)
    }

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