package es.verdnatura.presentation.view.component

import android.app.Dialog
import android.content.Context
import android.view.View
import es.verdnatura.R
import es.verdnatura.databinding.ComponentCustomTwoDialogBinding
//import kotlinx.android.synthetic.main.component_custom_two_dialog.*

class CustomDialogTwoButtons (context: Context) : Dialog(context, R.style.DialogTheme) {

    private var binding: ComponentCustomTwoDialogBinding= ComponentCustomTwoDialogBinding.inflate(layoutInflater)

    init {

        setContentView(binding.root)
        //setContentView(R.layout.component_custom_two_dialog)
    }


    fun setTitle(title: String): CustomDialogTwoButtons {

        binding.customDialogTitle.visibility= View.VISIBLE
        binding.customDialogTitle.text=title

       /* custom_dialog_title.visibility = View.VISIBLE
        custom_dialog_title.text = title*/
        return this
    }

    fun setDescription(description: String): CustomDialogTwoButtons {

        binding.customDialogDescription.visibility= View.VISIBLE
        binding.customDialogDescription.text=description
       /* custom_dialog_description.visibility = View.VISIBLE
        custom_dialog_description.text = description*/
        return this
    }

    fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {

        binding.customDialogButtonOk.visibility = View.VISIBLE
        binding.customDialogButtonOk.text =text
        binding.customDialogButtonOk.setOnClickListener { onButtonClicked() }

        /*custom_dialog_button_ok.visibility = View.VISIBLE
        custom_dialog_button_ok.text = text
        custom_dialog_button_ok.setOnClickListener { onButtonClicked() }*/
        return this
    }

    fun setOkButtonTwo(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {

        binding.customDialogButtonOkTwo.visibility = View.VISIBLE
        binding.customDialogButtonOkTwo.text = text
        binding.customDialogButtonOkTwo.setOnClickListener { onButtonClicked() }

      /*  custom_dialog_button_ok_two.visibility = View.VISIBLE
        custom_dialog_button_ok_two.text = text
        custom_dialog_button_ok_two.setOnClickListener { onButtonClicked() }*/
        return this
    }

    fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {

        binding.customDialogButtonKo.visibility = View.VISIBLE
        binding.customDialogButtonKo.text =text
        binding.customDialogButtonKo.setOnClickListener { onButtonClicked() }

        /*custom_dialog_button_ko.visibility = View.VISIBLE
        custom_dialog_button_ko.text = text
        custom_dialog_button_ko.setOnClickListener { onButtonClicked() }*/
        return this
    }

}