package com.all.pdfreader.pro.app.room.entity

import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey

@Entity(
    tableName = "bookmarks",
    foreignKeys = [ForeignKey(
        entity = PdfDocumentEntity::class,
        parentColumns = ["filePath"],
        childColumns = ["filePath"],
        onDelete = ForeignKey.CASCADE,
        onUpdate = ForeignKey.CASCADE
    )],
    indices = [Index(value = ["filePath"])]
)
data class BookmarkEntity(
    @PrimaryKey(autoGenerate = true)
    val id: Long = 0,
    
    val filePath: String,            // 关联PdfDocumentEntity的filePath
    val pageNumber: Int,            // 页码(从0开始)
    val label: String,              // 书签标签
    val positionX: Float = 0f,      // 页面内X位置
    val positionY: Float = 0f,      // 页面内Y位置
    val createTime: Long = System.currentTimeMillis()
)