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.ActivityGjjManifestAddBinding
import com.lukouguoji.gjj.viewModel.GjjManifestAddViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.noNull

class GjjManifestAddActivity :
    BaseBindingActivity<ActivityGjjManifestAddBinding, GjjManifestAddViewModel>() {

    override fun layoutId() = R.layout.activity_gjj_manifest_add

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

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国际进港舱单新增")
        viewModel.fid = intent.getStringExtra(Constant.Key.ID).noNull()
        viewModel.departure.value = intent.getStringExtra(Constant.Key.DEPARTURE).noNull()
        viewModel.destination.value = intent.getStringExtra(Constant.Key.DESTINATION).noNull()
        binding.viewModel = viewModel
    }

    companion object {
        @JvmStatic
        fun start(context: Context, fid: String = "", dep: String, dest: String) {
            val starter = Intent(context, GjjManifestAddActivity::class.java)
                .putExtra(Constant.Key.ID, fid)
                .putExtra(Constant.Key.DEPARTURE, dep)
                .putExtra(Constant.Key.DESTINATION, dest)
            context.startActivity(starter)
        }
    }
}