package com.sambath.kunkhmer.screen.event

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.sambath.kunkhmer.R
import com.sambath.kunkhmer.adapter.EventAdapter
import com.sambath.kunkhmer.adapter.EventCardItem
import com.sambath.kunkhmer.adapter.LivesAdapter
import com.sambath.kunkhmer.adapter.LivesCardItem
import kotlinx.android.synthetic.main.fragment_event.view.recyclerViewEvent

class EventFragment : Fragment() {
    private var _root: View? = null
    private val binding get() = _root!!

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        _root = inflater.inflate(R.layout.fragment_event, container, false)

        setEvent()

        return binding
    }

    private fun setEvent() {
        val recyclerView = binding.recyclerViewEvent
        val cardList = createCardList() // Create your card data list here
        val cardAdapter = EventAdapter(cardList)

        recyclerView.layoutManager =
            LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
        recyclerView.adapter = cardAdapter
    }

    private fun createCardList(): List<EventCardItem> {
        // Create and return your list of CardItems
        return listOf(
            EventCardItem(R.drawable.ic_bg_dashboard, "Title 1", "SubTitle 1", "DateTitle"),
            EventCardItem(R.drawable.ic_bg_dashboard, "Title 2", "SubTitle 2", "DateTitle"),
            EventCardItem(R.drawable.ic_bg_dashboard, "Title 3", "SubTitle 3", "DateTitle"),
            EventCardItem(R.drawable.ic_bg_dashboard, "Title 4", "SubTitle 4", "DateTitle"),
            EventCardItem(R.drawable.ic_bg_dashboard, "Title 5", "SubTitle 5", "DateTitle"),
            // Add more card items as needed
        )
    }
}