package app.furmeet.events.system.notification

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import app.furmeet.events.system.TranslatableAppCompatActivityWithScheduleServiceWrapped
import app.furmeet.events.system.schedule.managers.RemoteAssetsHolder
import app.furmeet.events.system.schedule.managers.ScheduleManagerGetter
import app.furmeet.events.bff.databinding.ActivityPastNotificationsBinding

class PastNotificationsActivity : TranslatableAppCompatActivityWithScheduleServiceWrapped() {

    override fun onCreate(savedInstanceState: Bundle?) {
        RemoteAssetsHolder.ensureIsBuilt(this)
        super.onCreate(savedInstanceState)
        val binding = ActivityPastNotificationsBinding.inflate(layoutInflater)
        val view = binding.root
        setContentView(view)
        setSupportActionBar(binding.toolbar)

        val scheduleManager = ScheduleManagerGetter[this]
        val announcements = scheduleManager.conventionSeries.announcements.sortedBy { -it.created.timeInMillis }

        binding.pastNotificationsRv.adapter = PastNotificationsAdapter(announcements)
        binding.pastNotificationsRv.layoutManager = LinearLayoutManager(this)
    }
}
