export default (configuration) => {
    return `
        
    package ${configuration.packageName}.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import ${configuration.name}.R
import ${configuration.name}.databinding.ItemAppAlertBinding
import ${configuration.packageName}.extensions.getTimeInAgo
import ${configuration.packageName}.extensions.loadImageFromUrl
import ${configuration.packageName}.extensions.setOnClickWithDebounce
import ${configuration.packageName}.model.remote.AlertModel


class AlertsAdapter(
    val onClick: (AlertModel) -> Unit
) :
    RecyclerView.Adapter<AlertsAdapter.ViewHolder>() {

    private val list: ArrayList<AlertModel> = ArrayList()

    inner class ViewHolder(val binding: ItemAppAlertBinding) :
        RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val itemView =
            ItemAppAlertBinding.inflate(LayoutInflater.from(parent.context), parent, false)
        return ViewHolder(itemView)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val model = list[position]
        println(model)
        with(holder.binding) {
            textViewAlertMsg.text = model.message
            tvTimeAgo.text = model.update_at.getTimeInAgo()
            imageView4.loadImageFromUrl(model.image)
            root.setOnClickWithDebounce {
                onClick(model)
            }
        }

    }

    override fun getItemCount(): Int {
        return list.size
    }

    fun refresh(newList: ArrayList<AlertModel>) {
        list.clear()
        list.addAll(newList)
        notifyDataSetChanged()
    }


}
    
    `
}