/*
 * Book's Story — free and open-source Material You eBook reader.
 * Copyright (C) 2024-2026 Acclorite
 * SPDX-License-Identifier: GPL-3.0-only
 */

package org.dueattendant149.bookshelf.domain.model.library

import android.net.Uri
import android.os.Parcelable
import androidx.compose.runtime.Immutable
import kotlinx.parcelize.Parcelize
import org.dueattendant149.bookshelf.core.ui.UIText

@Parcelize
@Immutable
data class Book(
    val id: Int = 0,

    val title: String,
    val author: UIText,
    val description: String?,

    val filePath: String,
    val coverImage: Uri?,

    val scrollIndex: Int,
    val scrollOffset: Int,
    val progress: Float,

    val lastOpened: Long?,
    val categories: List<Int>,

    // Remote / bookshelf fields
    val remoteId: String = "",
    val libraryId: String = "",
    val mediaType: String = "",
    val hasAudio: Boolean = false,
    val hasEbook: Boolean = false,
    val audioDuration: Long = 0L,
    val coverUrl: String = "",
    val lastSyncedAt: Long = 0L,
) : Parcelable {
    companion object {
        val default = Book(
            id = -1,
            title = "",
            author = UIText.StringValue(""),
            description = null,
            filePath = "",
            coverImage = null,
            scrollIndex = 0,
            scrollOffset = 0,
            progress = 0f,
            lastOpened = null,
            categories = emptyList(),
            remoteId = "",
            libraryId = "",
            mediaType = "",
            hasAudio = false,
            hasEbook = false,
            audioDuration = 0L,
            coverUrl = "",
            lastSyncedAt = 0L,
        )
    }
}