/*
 * 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.data.local.dto

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import org.dueattendant149.bookshelf.data.converter.CategoryConverter

@Entity
@TypeConverters(CategoryConverter::class)
data class BookEntity(
    @PrimaryKey(true) val id: Int = 0,
    val title: String,
    val author: String,
    val description: String?,
    val filePath: String,
    val scrollIndex: Int,
    val scrollOffset: Int,
    val progress: Float,
    val image: String? = null,
    @ColumnInfo(defaultValue = "[]") val categories: List<Int>,
    // Remote / bookshelf fields
    @ColumnInfo(defaultValue = "")
    val remoteId: String = "",
    @ColumnInfo(defaultValue = "")
    val libraryId: String = "",
    @ColumnInfo(defaultValue = "")
    val mediaType: String = "",
    @ColumnInfo(defaultValue = "0")
    val hasAudio: Boolean = false,
    @ColumnInfo(defaultValue = "0")
    val hasEbook: Boolean = false,
    @ColumnInfo(defaultValue = "0")
    val audioDuration: Long = 0L,
    @ColumnInfo(defaultValue = "")
    val coverUrl: String = "",
    @ColumnInfo(defaultValue = "0")
    val lastSyncedAt: Long = 0L,
)