import SwiftData
import Foundation

@Model
public final class VocabCard {
    public var front: String = ""
    public var back: String = ""
    public var deckId: String = ""
    public var examplesES: [String] = []
    public var examplesEN: [String] = []
    /// Per-example blank word for Complete the Sentence quiz. Index-aligned with `examplesES`.
    /// Empty string at a given index means "fall back to substring-matching card.front".
    public var examplesBlanks: [String] = []

    public var deck: CourseDeck?

    // Legacy SRS fields retained only so old local progress can be migrated to CourseReviewCard.
    public var easeFactor: Double = 2.5
    public var interval: Int = 0
    public var repetitions: Int = 0
    public var dueDate: Date = Date()
    public var lastReviewDate: Date?

    public init(front: String, back: String, deckId: String, examplesES: [String] = [], examplesEN: [String] = [], examplesBlanks: [String] = []) {
        self.front = front
        self.back = back
        self.deckId = deckId
        self.examplesES = examplesES
        self.examplesEN = examplesEN
        self.examplesBlanks = examplesBlanks
    }
}
