package com.sambath.kunkhmer.screen.lives

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.LivesAdapter
import com.sambath.kunkhmer.adapter.LivesCardItem
import kotlinx.android.synthetic.main.fragment_event.view.recyclerViewEvent
import kotlinx.android.synthetic.main.fragment_lives.view.recyclerViewLives

class LivesFragment : 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? {
        // Inflate the layout for this fragment
        _root = inflater.inflate(R.layout.fragment_lives, container, false)

        setEvent()

        return binding
    }

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

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

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