You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB
Kotlin

package moe.odango.index.entity
import io.requery.*
import moe.odango.index.utils.EntityHelper
import moe.odango.index.utils.helper
import java.util.*
@Entity
interface AniDBInfo : Persistable {
@get:Key
val id: UUID
@get:OneToOne
@get:ForeignKey
val anime: Anime
var type: ReleaseType
var restricted: Boolean
var episodes: Int?
var description: String
var image: String?
var startYear: Int?
var startMonth: Int?
var startDay: Int?
var endYear: Int?
var endMonth: Int?
var endDay: Int?
enum class ReleaseType {
Movie,
MusicVideo,
OVA,
Other,
TVSeries,
TVSpecial,
Web,
Unknown;
companion object {
fun fromAniDBString(value: String): ReleaseType = when (value.toLowerCase()) {
"movie" -> Movie
"music video" -> MusicVideo
"ova" -> OVA
"other" -> Other
"tv series" -> TVSeries
"tv special" -> TVSpecial
"web" -> Web
else -> Unknown
}
}
}
companion object : EntityHelper<AniDBInfoEntity> by helper(::AniDBInfoEntity, {
setId(UUID.randomUUID())
})
}