package com.lukouguoji.gnc.page.distribution.home.dialog

import android.content.Context
import androidx.lifecycle.MutableLiveData
import com.lukouguoji.gnc.R
import com.lukouguoji.gnc.databinding.DialogGncDistributionDriverBinding
import com.lukouguoji.module_base.base.BaseDialogModel
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
import dev.utils.app.info.KeyValue

class GncDistributionDriverDialogModel(
    val carList: String,
    val driverList: List<KeyValue>,
    private val callBack: (GncDistributionDriverDialogModel) -> Unit
) : BaseDialogModel<DialogGncDistributionDriverBinding>(DIALOG_TYPE_CENTER) {

    // 司机
    val driver = MutableLiveData("")

    override fun layoutId(): Int {
        return R.layout.dialog_gnc_distribution_driver
    }

    override fun onDialogCreated(context: Context) {
        binding.model = this
    }

    fun onConfirmClick() {
        if (driver.value.verifyNullOrEmpty("请选择司机")) {
            return
        }
        dismiss()
        callBack(this)
    }

}