package com.lukouguoji.module_base.model

import android.content.Context
import com.lukouguoji.module_base.R
import com.lukouguoji.module_base.base.BaseDialogModel
import com.lukouguoji.module_base.databinding.DialogConfirmBinding

class ConfirmDialogModel(
    val message: String,
    val title: String = "",
    val confirmText: String = "确认",
    val cancelText: String = "取消",
    private val cancelListener: () -> Unit = {},
    private val confirmListener: () -> Unit
) : BaseDialogModel<DialogConfirmBinding>(DIALOG_TYPE_CENTER) {

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

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

    fun onConfirmClick() {
        confirmListener.invoke()
        dismiss()
    }

    fun onCancelClick() {
        cancelListener.invoke()
        dismiss()
    }

}