package eu.friedcutlet.yokan.database import kotlinx.serialization.Serializable import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.JsonNames @Serializable enum class DbNovelReadingMode { Scroll, Paged } @Serializable enum class DbNovelPageMode { Single, Double, Auto } @Serializable enum class DbGlobalStatusVisibility { Automatic, AlwaysVisible, Hidden, } @Serializable data class DbTitleMetadata( val mangaId: Long, val metadataServerId: String? = null, val metadataSource: String? = null, val titles: List = emptyList(), val updatedAt: Long = 0, ) @Serializable data class DbAutomaticReaderLayout(val mangaId: Long, val enabled: Boolean = true, val fallback: DbReaderMode? = null) @OptIn(ExperimentalSerializationApi::class) @Serializable data class DbSettings( @JsonNames("home") @Serializable(with = DbFeaturePreferencesSerializer::class) val features: DbFeaturePreferences = DbFeaturePreferences(), val id: Long = 227, val updatedAt: Long = 0, val completedOnboardingVersion: Int = 0, val displayType: DbDisplayType = DbDisplayType.CompactGrid, val libraryFilterMangasDownloadType: Int = 0, val libraryFilterMangasUnreadType: Int = 0, val libraryFilterMangasStartedType: Int = 0, val libraryFilterMangasBookMarkedType: Int = 0, val libraryShowCategoryTabs: Boolean = false, val libraryDownloadedChapters: Boolean = false, val libraryShowLanguage: Boolean = false, val libraryShowSource: Boolean = false, val libraryShowNumbersOfItems: Boolean = false, val libraryShowContinueReadingButton: Boolean = false, val libraryLocalSource: Boolean? = null, val librarySearchQuery: String = "", val sortLibraryManga: DbSortLibraryManga? = null, val sortChapterList: List? = null, val chapterFilterDownloadedList: List? = null, val chapterFilterUnreadList: List? = null, val chapterFilterBookmarkedList: List? = null, val flexColorSchemeBlendLevel: Double = 10.0, val dateFormat: String = "M/d/y", val relativeTimesTamps: Int = 2, val flexSchemeColorIndex: Int = 2, val themeIsDark: Boolean = false, val followSystemTheme: Boolean = false, val incognitoMode: Boolean = false, val showPagesNumber: Boolean = true, val chapterPageIndexList: List? = null, val userAgent: String = DefaultUserAgent, val cookiesList: List? = null, val defaultReaderMode: DbReaderMode = DbReaderMode.Vertical, val automaticReaderLayout: Boolean = false, val readerHoldToScroll: Boolean = false, /** E-ink display: monochrome theme, no motion, grayscale pages and periodic full refresh. Device-local. */ val einkMode: Boolean = false, val einkPreset: DbEinkPreset = DbEinkPreset.KindlePaperwhite, val einkRefreshEveryPages: Int = 6, /** With [einkMode], manga page downloads are stored as grayscale JPEGs sized for [einkPreset]. */ val einkOptimizeDownloads: Boolean = false, val automaticReaderLayouts: List = emptyList(), val personalReaderModeList: List? = null, val animatePageTransitions: Boolean = true, val doubleTapAnimationSpeed: Int = 1, val onlyIncludePinnedSources: Boolean = false, val pureBlackDarkMode: Boolean = false, val downloadOnlyOnWifi: Boolean = false, val saveAsCBZArchive: Boolean = false, val deleteDownloadAfterReading: Boolean = false, val concurrentDownloads: Int = 2, val allowConcurrentDownloads: Boolean = true, val downloadDelaySeconds: Int = 0, val downloadQueueOrder: List = emptyList(), val networkDownloadSpeedLimitKib: Int = 0, val networkUploadSpeedLimitKib: Int = 0, val downloadLocation: String = "", val filterScanlatorList: List? = null, val chapterReleasePreferences: List = emptyList(), val autoExtensionsUpdates: Boolean = false, /** Relaxes host-only safety gates for local development, e.g. recipe catalogs served from `http://127.0.0.1`. */ val developerMode: Boolean = false, /** Hub URLs the user added next to the published list; may be LAN or loopback, so device-local. */ val customHubServers: List = emptyList(), val cropBorders: Boolean = false, val locale: DbL10nLocale? = null, val defaultSubtitleLang: DbL10nLocale? = null, val animeDisplayType: DbDisplayType = DbDisplayType.CompactGrid, val libraryFilterAnimeDownloadType: Int = 0, val libraryFilterAnimeUnreadType: Int = 0, val libraryFilterAnimeStartedType: Int = 0, val libraryFilterAnimeBookMarkedType: Int = 0, val animeLibraryShowCategoryTabs: Boolean = false, val animeLibraryDownloadedChapters: Boolean = false, val animeLibraryShowLanguage: Boolean = false, val animeLibraryShowSource: Boolean = false, val animeLibraryShowNumbersOfItems: Boolean = false, val animeLibraryShowContinueReadingButton: Boolean = false, val animeLibraryLocalSource: Boolean? = null, val animeLibrarySearchQuery: String = "", val sortLibraryAnime: DbSortLibraryManga? = null, val pagePreloadAmount: Int = 6, val enableLogs: Boolean = false, val checkForAppUpdates: Boolean = true, val checkForExtensionUpdates: Boolean = true, val scaleType: DbScaleType = DbScaleType.FitScreen, val backgroundColor: DbBackgroundColor = DbBackgroundColor.Black, val personalPageModeList: List? = null, val startDateBackup: Long? = null, val backupFrequency: Int? = null, val backupListOptions: List? = null, val autoBackupLocation: String? = null, val usePageTapZones: Boolean = true, val alwaysShowChrome: Boolean = false, val autoScrollPages: List? = null, val autoScrollSpeed: Double = 4.0, /** * Opt-in: when true, `AppLogger` / `ExtensionLogger` / network logging * append timestamped lines to a log file at * `LocalFileService.cacheRoot/logs/yokan.log`. Always off by default; * stdout output is unaffected. */ val enableFileLogging: Boolean = false, val markEpisodeAsSeenType: Int = 85, val defaultSkipIntroLength: Int = 85, val defaultDoubleTapToSkipLength: Int = 10, val defaultPlaybackSpeed: Double = 1.0, val fullScreenPlayer: Boolean = false, val forceLandscapePlayer: Boolean = false, /** Retained only for compatibility with existing serialized settings; no longer used. */ val desktopUseVlcj: Boolean = false, val updateProgressAfterReading: Boolean = true, val enableAniSkip: Boolean? = null, val enableAutoSkip: Boolean? = null, val aniSkipTimeoutLength: Int? = null, val customDns: String = "", val dohEnabled: Boolean = false, val dohProviderId: Int = 0, val customDohUrl: String = "", val cloudflareBypassProxyUrl: String = "", val btServerAddress: String = "127.0.0.1", val btServerPort: Int? = null, val fullScreenReader: Boolean = true, val customColorFilter: DbCustomColorFilter? = null, val enableCustomColorFilter: Boolean = false, val colorFilterBlendMode: DbColorFilterBlendMode = DbColorFilterBlendMode.None, val playerSubtitleSettings: DbPlayerSubtitleSettings? = null, val mangaHomeDisplayType: DbDisplayType = DbDisplayType.ComfortableGrid, val appFontFamily: String? = null, /** UI density scale (1.0 = system default). Multiplies LocalDensity.density and fontScale. */ val uiScale: Double = 1.0, val autoUiScale: Boolean = false, val mangaGridSize: Int? = null, val animeGridSize: Int? = null, val novelGridSize: Int? = null, val mangaExtensionsRepo: List? = null, val animeExtensionsRepo: List? = null, val novelExtensionsRepo: List? = null, val androidProxyServer: String? = null, val jrePath: String = "", val extensionServerPath: String = "", val disableSectionType: DbSectionType = DbSectionType.All, val useLibass: Boolean = true, val hwdecMode: String = "auto", val enableHardwareAcceleration: Boolean? = null, val libraryFilterNovelDownloadType: Int = 0, val libraryFilterNovelUnreadType: Int = 0, val libraryFilterNovelStartedType: Int = 0, val libraryFilterNovelBookMarkedType: Int = 0, val novelLibraryShowCategoryTabs: Boolean = false, val novelLibraryDownloadedChapters: Boolean = false, val novelLibraryShowLanguage: Boolean = false, val novelLibraryShowSource: Boolean = false, val novelLibraryShowNumbersOfItems: Boolean = false, val novelLibraryShowContinueReadingButton: Boolean = false, val novelLibraryLocalSource: Boolean? = null, val novelLibrarySearchQuery: String = "", val sortLibraryNovel: DbSortLibraryManga? = null, val novelDisplayType: DbDisplayType = DbDisplayType.ComfortableGrid, val novelFontSize: Int = 14, val novelReadingMode: DbNovelReadingMode = DbNovelReadingMode.Scroll, val novelPageMode: DbNovelPageMode = DbNovelPageMode.Auto, val novelFontFamily: String = "Default", val novelTextAlign: DbNovelTextAlign = DbNovelTextAlign.Left, val novelReaderTheme: String = "#292832", val novelReaderTextColor: String = "#CCCCCC", val novelReaderPadding: Int = 16, val novelReaderLineHeight: Double = 1.5, val novelShowScrollPercentage: Boolean = true, val novelRemoveExtraParagraphSpacing: Boolean = false, val novelTapToScroll: Boolean = false, val navigationOrder: List? = null, val hideItems: List? = null, val clearChapterCacheOnAppLaunch: Boolean = false, val lastTrackerLibraryLocation: String? = null, val mergeLibraryNavMobile: Boolean = false, val showLocalLibraryNavigation: Boolean = false, val enableDiscordRpc: Boolean = true, val hideDiscordRpcInIncognito: Boolean = true, val rpcShowReadingWatchingProgress: Boolean = true, val rpcShowTitle: Boolean = true, val rpcShowCoverImage: Boolean = true, val useMpvConfig: Boolean = true, val debandingType: DbDebandingType = DbDebandingType.None, val enableGpuNext: Boolean = false, val useYuv420p: Boolean = false, val audioPreferredLanguages: String? = null, val enableAudioPitchCorrection: Boolean? = null, val audioChannels: DbAudioChannel = DbAudioChannel.AutoSafe, val volumeBoostCap: Int? = null, val downloadedOnlyMode: Boolean = false, val globalStatusVisibility: DbGlobalStatusVisibility = DbGlobalStatusVisibility.Automatic, val algorithmWeights: DbAlgorithmWeights? = null, val sourcePreferences: List? = null, val savedSearches: List? = null, val updateErrors: List? = null, val tvUiScale: Double? = null, val animeOnlyTvMode: Boolean? = null, val tvHomeStyle: Boolean? = null, val trackerOrder: List? = null, /** Legacy custom local folders stored before folders had user-facing names. Migrated to [namedLocalFolders] on access. */ val localFolders: List? = null, val namedLocalFolders: List? = null, val downloadLocalFolderName: String? = null, val askDownloadDestination: Boolean = true, /** ARGB-packed seed color used by MaterialKolor. Null = derive from [flexSchemeColorIndex] for backwards compat. */ val themeSeedColor: Int? = null, /** Path to an image whose dominant color seeds the palette. Takes precedence over [themeSeedColor] when set. */ val themeSeedImagePath: String? = null, /** Material You: on Android 12+ derive scheme from the device wallpaper. Ignored on other platforms. */ val materialYou: Boolean = false, /** Material Expressive: enables MaterialExpressiveTheme and the SPEC_2025 expressive color spec. */ val materialExpressive: Boolean = false, /** PaletteStyle name (TonalSpot, Vibrant, Expressive, Monochrome, …). Defaults to Tonal Spot. */ val themePaletteStyle: String = "TonalSpot", val appLockEnabled: Boolean = false, val libraryFilterMangasCompletedType: Int = 0, val libraryFilterAnimeCompletedType: Int = 0, val libraryFilterNovelCompletedType: Int = 0, val libraryFilterMangasTrackingType: Int = 0, val libraryFilterAnimeTrackingType: Int = 0, val libraryFilterNovelTrackingType: Int = 0, val keepScreenOnReader: Boolean = true, val webtoonSidePadding: Int = 0, val showPageGaps: Boolean = true, val autoReadDuplicateChapters: Boolean = false, val invertColors: Boolean = false, val grayscale: Boolean = false, val readerBrightness: Double = 0.0, val readerContrast: Double = 1.0, val readerSaturation: Double = 1.0, val readerNavigationLayout: Int = 0, val backupCompressionLevel: Int? = null, val backupEncryptionEnabled: Boolean = false, val backupEncryptionPassword: String? = null, val showNsfw: Boolean = false, val ttsSpeechRate: Double = 0.5, val ttsPitch: Double = 1.0, val ttsLanguage: String? = null, val ttsVoice: String? = null, /** Base URL for a self-hosted / third-party metadata API server. */ val metadataServerUrl: String = "http://127.0.0.1:3000", /** Opt-in automatic metadata enrichment. Manual checks still use [metadataServerUrl]. */ val metadataServerEnabled: Boolean = false, /** Periodic metadata refresh cadence; zero disables the job. */ val metadataRefreshFrequencySeconds: Int = 0, /** Optional Bearer token used when the metadata server tracker endpoints are enabled. */ val metadataServerToken: String = "", /** Periodic manga/anime/novel library update cadence; zero disables the job. */ val libraryUpdateFrequencySeconds: Int = 0, /** * Minutes after local midnight for a fixed daily library update; `-1` means repeat every * [libraryUpdateFrequencySeconds] instead. Only honoured while the job is enabled. */ val libraryUpdateDailyAtMinutes: Int = -1, /** Desktop only: closing the window hides to the tray so scheduled tasks keep running. Device-local. */ val desktopCloseToTray: Boolean = false, /** Desktop only: register an OS login item that starts Yokan hidden in the tray. Device-local. */ val desktopLaunchAtLogin: Boolean = false, /** Per-entry scraped metadata kept in the settings blob to avoid Room row migrations. */ val titleMetadata: List? = null, /** Set once [eu.friedcutlet.yokan.database.sync.SyncIdentityMigration] has rewritten local ids to stable hub ids. Device-local. */ val syncIdentityVersion: Int = 0, ) { val home: DbHomePreferences get() = features.home } const val DefaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120 Safari/537.36"