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 com.manaknight.app.model.remote.GetOneUserResponse


    class FriendListAdapter(
        private var dataset: List<GetOneUserResponse>
          ): RecyclerView.Adapter<FriendListAdapter.ViewHolder>()    {

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

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

init {

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

fun bind(model: GetOneUserResponse) {
var fName = model.first_name
var lName = model.last_name
if (fName == null) {
fName = "No First Name"
} else if (fName.isEmpty()) {
fName = "No First Name"
}

if (lName == null) {
lName = "No Last Name"
} else if (lName.isEmpty()) {
lName = "No First Name"
}

view.findViewById<TextView>(R.id.data_id).text = fName + " " + lName
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val adapterLayout = LayoutInflater.from(parent.context)
.inflate(R.layout.user_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<GetOneUserResponse>) {
dataset = newData
notifyDataSetChanged()
}
}
    
    
    
      `;
  };
  