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)
    }


    fun setTitle(title: String): CustomDialogTwoButtons {

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

        return this
    }

    fun setDescription(description: String): CustomDialogTwoButtons {

        binding.customDialogDescription.visibility= View.VISIBLE
        binding.customDialogDescription.text=description

        return this
    }

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

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

        return this
    }

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

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

        return this
    }
    fun setOkButtonThree(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {

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

        return this
    }

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

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

        return this
    }

}