package com.rssuper.models import android.os.Parcelable import androidx.room.Entity import androidx.room.PrimaryKey import androidx.room.TypeConverters import com.rssuper.converters.DateConverter import kotlinx.parcelize.Parcelize import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import java.util.Date @JsonClass(generateAdapter = true) @Parcelize @TypeConverters(DateConverter::class) @Entity(tableName = "search_results") data class SearchResult( @PrimaryKey val id: String, @Json(name = "type") val type: SearchResultType, @Json(name = "title") val title: String, @Json(name = "snippet") val snippet: String? = null, @Json(name = "link") val link: String? = null, @Json(name = "feedTitle") val feedTitle: String? = null, @Json(name = "published") val published: Date? = null, @Json(name = "score") val score: Double? = null ) : Parcelable enum class SearchResultType { @Json(name = "article") ARTICLE, @Json(name = "feed") FEED }