package com.rssuper.models

import android.os.Parcelable
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.parcelize.Parcelize
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
@Parcelize
@Entity(tableName = "reading_preferences")
data class ReadingPreferences(
    @PrimaryKey
    val id: String = "default",
    
    @Json(name = "fontSize")
    val fontSize: FontSize = FontSize.MEDIUM,
    
    @Json(name = "lineHeight")
    val lineHeight: LineHeight = LineHeight.NORMAL,
    
    @Json(name = "showTableOfContents")
    val showTableOfContents: Boolean = false,
    
    @Json(name = "showReadingTime")
    val showReadingTime: Boolean = true,
    
    @Json(name = "showAuthor")
    val showAuthor: Boolean = true,
    
    @Json(name = "showDate")
    val showDate: Boolean = true
) : Parcelable

sealed class FontSize(val value: String) {
    @Json(name = "small")
    data object SMALL : FontSize("small")
    
    @Json(name = "medium")
    data object MEDIUM : FontSize("medium")
    
    @Json(name = "large")
    data object LARGE : FontSize("large")
    
    @Json(name = "xlarge")
    data object XLARGE : FontSize("xlarge")
}

sealed class LineHeight(val value: String) {
    @Json(name = "normal")
    data object NORMAL : LineHeight("normal")
    
    @Json(name = "relaxed")
    data object RELAXED : LineHeight("relaxed")
    
    @Json(name = "loose")
    data object LOOSE : LineHeight("loose")
}
