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

    import ${configuration.name}.R
    import android.content.Context
    import android.view.LayoutInflater
    import android.view.View
    import android.view.ViewGroup
    import android.widget.TextView
    import android.widget.ImageView
    import androidx.recyclerview.widget.RecyclerView
    import ${configuration.packageName}.extensions.loadImageFromUrl
    import androidx.navigation.findNavController
    import ${configuration.packageName}.model.remote.ChatRoomListResponse
    import ${configuration.packageName}.model.remote.ChatRoomResponse


    class ChatRoomAdapter(
                              private var dataset: List<ChatRoomListResponse>
                                ): RecyclerView.Adapter<ChatRoomAdapter.ViewHolder>()    {

        var onItemClick: ((ChatRoomListResponse) -> Unit)? = null

        inner class ViewHolder(private val view: View): RecyclerView.ViewHolder(view) {

            init {

                view.setOnClickListener{
                    onItemClick?.invoke(dataset[adapterPosition])
                }
            }

            fun bind(model: ChatRoomListResponse) {
                view.findViewById<TextView>(R.id.data_id).text = "Room ID: "+model.id
            }
        }
    
        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
            val adapterLayout = LayoutInflater.from(parent.context)
                .inflate(R.layout.room_data, parent, false)
    
            return ViewHolder(adapterLayout)
        }
    
        override fun getItemCount(): Int {
            return dataset.size;
        }
    
        override fun onBindViewHolder(holder: ViewHolder, position: Int) {
            val item = dataset[position]
            holder.bind(item)
        }

        fun updateData(newData: List<ChatRoomListResponse>) {
            dataset = newData
            notifyDataSetChanged()
        }
    }
    
    
    
      `;
  };
  