@file:Suppress("HardCodedStringLiteral")

package eu.gaudian.translator.model

import androidx.annotation.StringRes
import eu.gaudian.translator.R


sealed class WidgetType(val id: String, @param:StringRes val titleRes: Int) {
    data object Status : WidgetType("status", R.string.label_status)
    data object Streak : WidgetType("streak", R.string.title_widget_streak)
    data object AllVocabulary : WidgetType("all_vocabulary", R.string.label_all_vocabulary)
    data object DueToday : WidgetType("due_today", R.string.title_widget_due_today)
    data object CategoryProgress : WidgetType("category_progress", R.string.label_categories)
    data object WeeklyActivityChart : WidgetType("weekly_activity_chart", R.string.text_widget_title_weekly_activity)
    data object Levels : WidgetType("category_stats", R.string.levels)

    companion object {
        /**
         * The default order of widgets when the app is first launched or if no order is saved.
         */
        val DEFAULT_ORDER = listOf(
            Status,
            Streak,
            AllVocabulary,
            DueToday,
            CategoryProgress ,
            WeeklyActivityChart,
            Levels,
        )


        fun fromId(id: String?): WidgetType? {
            return DEFAULT_ORDER.find { it.id == id }
        }
    }
}