package com.tanya.careerguidanceproject

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
//import com.tanya.careerguidanceproject.activities.CourseRecyclerAdapter
import com.tanya.careerguidanceproject.model.College
//import com.tanya.careerguidanceproject.model.Course

class CollegeRecyclerAdapter (val context : Context, private val collegeInfoList : ArrayList<College>) : RecyclerView.Adapter<CollegeRecyclerAdapter.DashboardViewHolder> (){
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DashboardViewHolder {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.college_rv_item, parent, false)

        return DashboardViewHolder(view)
    }

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

    override fun onBindViewHolder(holder: DashboardViewHolder, position: Int) {
        val modal = collegeInfoList[position]
        holder.collegeName.text = modal.collegeName
        holder.collegeCity.text = modal.collegeCity
        holder.collegeDesc.text = modal.collegeDescription

    }
    class DashboardViewHolder(view: View) : RecyclerView.ViewHolder(view){
        val collegeName : TextView = view.findViewById(R.id.txtCollegeName)
        val collegeCity : TextView = view.findViewById(R.id.txtCollegeCity)
        val collegeDesc : TextView = view.findViewById(R.id.txtCollegeDescription)

    }
}