Yokan / rebuild
Course 1 8624561

Models.kt

composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/domain/Models.kt

implementation295 lines
1package eu.friedcutlet.yokan.domain23enum class ItemType(val label: String) {4    Manga("Manga"),5    Anime("Anime"),6    Novel("Novel"),7}89enum class Status(val label: String) {10    Ongoing("Ongoing"),11    Completed("Completed"),12    Canceled("Canceled"),13    Unknown("Unknown"),14    OnHiatus("On hiatus"),15    PublishingFinished("Publishing finished"),16    Licensed("Licensed"),17    Upcoming("Upcoming"),18}1920enum class SourceCodeLanguage(val label: String) {21    JavaScript("JavaScript"),22    Mihon("Mihon"),23    LnReader("LNReader"),24    Aidoku("Aidoku"),25}2627enum class TrackStatus(val label: String) {28    Reading("Reading"),29    Completed("Completed"),30    OnHold("On hold"),31    Dropped("Dropped"),32    PlanToRead("Plan to read"),33    ReReading("Re-reading"),34    Watching("Watching"),35    PlanToWatch("Plan to watch"),36    ReWatching("Re-watching"),37}3839enum class ReaderMode(val label: String) {40    Paged("Paged"),41    ContinuousVertical("Continuous vertical"),42    Webtoon("Webtoon"),43    Novel("Novel"),44}4546data class Repo(47    val name: String,48    val jsonUrl: String,49    val website: String? = null,50)5152data class Source(53    val id: Long,54    val name: String,55    val baseUrl: String,56    val lang: String,57    val itemType: ItemType,58    val typeSource: String,59    val iconUrl: String? = null,60    val isActive: Boolean = true,61    val isAdded: Boolean = false,62    val isPinned: Boolean = false,63    val isNsfw: Boolean = false,64    val hasCloudflare: Boolean = false,65    val supportLatest: Boolean = false,66    val version: String = "0.0.1",67    val versionLast: String = "0.0.1",68    val lastUsed: Boolean = false,69    val isObsolete: Boolean = false,70    val sourceCodeLanguage: SourceCodeLanguage = SourceCodeLanguage.JavaScript,71    val repo: Repo? = null,72    val notes: String = "",73)7475data class Category(76    val id: Long,77    val name: String,78    val forItemType: ItemType,79    val position: Int,80    val hidden: Boolean = false,81    val shouldUpdate: Boolean = true,82)8384data class Manga(85    val id: Long,86    val name: String,87    val alternativeTitles: List<String> = emptyList(),88    val link: String,89    val imageUrl: String? = null,90    val customCoverImage: ByteArray? = null,91    val customCoverFromTracker: String? = null,92    val description: String,93    val author: String? = null,94    val artist: String? = null,95    val status: Status,96    val itemType: ItemType,97    val genres: List<String> = emptyList(),98    val favorite: Boolean = false,99    val source: String,100    val lang: String,101    val dateAddedMillis: Long,102    val lastUpdateMillis: Long,103    val lastReadMillis: Long = 0L,104    val categories: List<Long> = emptyList(),105    val isLocalArchive: Boolean = false,106    val smartUpdateDays: Int? = null,107    val sourceId: Long? = null,108    val metadataServerId: String? = null,109    val metadataSource: String? = null,110    val metadataUpdatedAt: Long = 0L,111    val privateNote: String = "",112    val nextEpisodeAiringAt: Long = 0,113    val nextEpisodeNumber: Int? = null,114    val cast: List<TitleCredit> = emptyList(),115    /** Owning title when this record is one season of an Animetail Seasons-type title. */116    val parentId: Long? = null,117    /** Animetail `FetchType.Seasons`: this title lists season records instead of episodes. */118    val fetchesSeasons: Boolean = false,119    val seasonNumber: Double? = null,120) {121    override fun toString(): String = "Manga(id=$id)"122    override fun equals(other: Any?): Boolean {123        if (this === other) return true124        if (other == null || this::class != other::class) return false125126        other as Manga127128        if (id != other.id) return false129        if (favorite != other.favorite) return false130        if (dateAddedMillis != other.dateAddedMillis) return false131        if (lastUpdateMillis != other.lastUpdateMillis) return false132        if (lastReadMillis != other.lastReadMillis) return false133        if (isLocalArchive != other.isLocalArchive) return false134        if (smartUpdateDays != other.smartUpdateDays) return false135        if (sourceId != other.sourceId) return false136        if (metadataServerId != other.metadataServerId) return false137        if (metadataSource != other.metadataSource) return false138        if (metadataUpdatedAt != other.metadataUpdatedAt) return false139        if (name != other.name) return false140        if (alternativeTitles != other.alternativeTitles) return false141        if (link != other.link) return false142        if (imageUrl != other.imageUrl) return false143        if (!customCoverImage.contentEquals(other.customCoverImage)) return false144        if (customCoverFromTracker != other.customCoverFromTracker) return false145        if (privateNote != other.privateNote) return false146        if (nextEpisodeAiringAt != other.nextEpisodeAiringAt) return false147        if (nextEpisodeNumber != other.nextEpisodeNumber) return false148        if (description != other.description) return false149        if (author != other.author) return false150        if (artist != other.artist) return false151        if (status != other.status) return false152        if (itemType != other.itemType) return false153        if (genres != other.genres) return false154        if (source != other.source) return false155        if (lang != other.lang) return false156        if (categories != other.categories) return false157        if (cast != other.cast) return false158        if (parentId != other.parentId) return false159        if (fetchesSeasons != other.fetchesSeasons) return false160        if (seasonNumber != other.seasonNumber) return false161162        return true163    }164165    override fun hashCode(): Int {166        var result = id.hashCode()167        result = 31 * result + favorite.hashCode()168        result = 31 * result + dateAddedMillis.hashCode()169        result = 31 * result + lastUpdateMillis.hashCode()170        result = 31 * result + lastReadMillis.hashCode()171        result = 31 * result + isLocalArchive.hashCode()172        result = 31 * result + (smartUpdateDays ?: 0)173        result = 31 * result + (sourceId?.hashCode() ?: 0)174        result = 31 * result + (metadataServerId?.hashCode() ?: 0)175        result = 31 * result + (metadataSource?.hashCode() ?: 0)176        result = 31 * result + metadataUpdatedAt.hashCode()177        result = 31 * result + name.hashCode()178        result = 31 * result + alternativeTitles.hashCode()179        result = 31 * result + link.hashCode()180        result = 31 * result + (imageUrl?.hashCode() ?: 0)181        result = 31 * result + (customCoverImage?.contentHashCode() ?: 0)182        result = 31 * result + (customCoverFromTracker?.hashCode() ?: 0)183        result = 31 * result + privateNote.hashCode()184        result = 31 * result + nextEpisodeAiringAt.hashCode()185        result = 31 * result + (nextEpisodeNumber ?: 0)186        result = 31 * result + description.hashCode()187        result = 31 * result + (author?.hashCode() ?: 0)188        result = 31 * result + (artist?.hashCode() ?: 0)189        result = 31 * result + status.hashCode()190        result = 31 * result + itemType.hashCode()191        result = 31 * result + genres.hashCode()192        result = 31 * result + source.hashCode()193        result = 31 * result + lang.hashCode()194        result = 31 * result + categories.hashCode()195        result = 31 * result + cast.hashCode()196        result = 31 * result + (parentId?.hashCode() ?: 0)197        result = 31 * result + fetchesSeasons.hashCode()198        result = 31 * result + (seasonNumber?.hashCode() ?: 0)199        return result200    }201}202203data class Chapter(204    val id: Long,205    val mangaId: Long,206    val name: String,207    val url: String,208    val dateUpload: String = "",209    val scanlator: String = "",210    val isBookmarked: Boolean = false,211    val isRead: Boolean = false,212    val lastPageRead: String = "",213    val archivePath: String = "",214    /** Effective filler state: the user's [fillerOverride] when set, otherwise the source value. */215    val isFiller: Boolean = false,216    val thumbnailUrl: String? = null,217    val description: String? = null,218    val downloadSize: String? = null,219    val duration: String? = null,220    val fetchedAt: Long = 0,221    val number: Double? = null,222    val season: Int? = null,223    val numberingName: String? = null,224    val fillerOverride: Boolean? = null,225)226227data class History(228    val id: Long,229    val mangaId: Long,230    val chapterId: Long,231    val itemType: ItemType,232    val title: String,233    val chapterName: String,234    val date: String,235    val readingTimeSeconds: Int,236    val updatedAt: Long,237    /** Last reading position recorded for the chapter (page number or %). Empty when never opened. */238    val lastPageRead: String = "",239    /** Whether the chapter is fully read; used by the History row to label "Finished" vs "Resume". */240    val chapterIsRead: Boolean = false,241)242243data class Track(244    val id: Long,245    val libraryId: Long,246    val mediaId: Long,247    val mangaId: Long,248    val syncId: Int,249    val title: String,250    val progress: Int,251    val total: Int,252    val score: Int,253    val status: TrackStatus,254    val trackingUrl: String,255    val itemType: ItemType,256)257258data class UpdateEntry(259    val id: Long,260    val mangaId: Long,261    val chapterId: Long,262    val itemType: ItemType,263    val title: String,264    val chapterName: String,265    val source: String,266    val date: String,267    val isRead: Boolean,268    val updatedAt: Long,269)270271data class UserSettings(272    val displayType: DisplayType = DisplayType.ComfortableGrid,273    val followSystemTheme: Boolean = true,274    val darkTheme: Boolean = false,275    val incognitoMode: Boolean = false,276    val downloadedOnly: Boolean = false,277    val defaultReaderMode: ReaderMode = ReaderMode.Paged,278    val libraryShowCategoryTabs: Boolean = true,279    val libraryShowLanguage: Boolean = true,280    val libraryShowSource: Boolean = false,281    val libraryShowNumbersOfItems: Boolean = true,282    val showPagesNumber: Boolean = true,283    val concurrentDownloads: Int = 3,284    val allowConcurrentDownloads: Boolean = true,285    val downloadDelaySeconds: Int = 0,286    val checkForAppUpdates: Boolean = true,287    val checkForExtensionUpdates: Boolean = true,288)289290enum class DisplayType(val label: String) {291    CompactGrid("Compact grid"),292    ComfortableGrid("Comfortable grid"),293    CoverOnlyGrid("Cover-only grid"),294    List("List"),295}296

Search chapters, reference and source filenames.