import Foundation
import SwiftData

/// A long-form bilingual book bundled with the app. Chapter content lives in
/// `BookChapter` rows; this model carries the per-book metadata.
@Model
public final class Book {
    @Attribute(.unique) public var id: String = ""    // matches `slug`
    public var slug: String = ""
    public var title: String = ""
    public var author: String = ""
    public var language: String = ""
    public var chapterCount: Int = 0
    public var accentColorHex: String = ""

    public init(
        slug: String,
        title: String,
        author: String,
        language: String,
        chapterCount: Int,
        accentColorHex: String
    ) {
        self.id = slug
        self.slug = slug
        self.title = title
        self.author = author
        self.language = language
        self.chapterCount = chapterCount
        self.accentColorHex = accentColorHex
    }
}
